Completed
Push — master ( 662b61...b40adf )
by George
04:45 queued 02:21
created

VibroCompiler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 61
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: georg
5
 * Date: 5/26/2018
6
 * Time: 1:30 PM
7
 */
8
9
namespace Ghaskell\Scaffold;
10
11
use Illuminate\View\Compilers\BladeCompiler;
12
13
14
class VibroCompiler extends BladeCompiler
15
{
16
17
    /**
18
     * Array of opening and closing tags for raw echos.
19
     *
20
     * @var array
21
     */
22
    protected $rawTags = ['<%', '%>'];
23
24
25
    /**
26
     * Array of opening and closing tags for regular echos.
27
     *
28
     * @var array
29
     */
30
//    protected $contentTags = ['<%', '%>'];
0 ignored issues
show
Bug introduced by
A parse error occurred: Syntax error, unexpected ';', expecting T_FUNCTION or T_CONST on line 30 at column 39
Loading history...
31
32
    /**
33
     * Array of opening and closing tags for escaped echos.
34
     *
35
     * @var array
36
     */
37
    protected $escapedTags = ['<%%%', '%%%>'];
38
39
    /**
40
     * The "regular" / legacy echo string format.
41
     *
42
     * @var string
43
     */
44
    protected $echoFormat = 'e(%s)';
45
46
    /**
47
     * Array of footer lines to be added to template.
48
     *
49
     * @var array
50
     */
51
    protected $footer = [];
52
53
    /**
54
     * Array to temporary store the raw blocks found in the template.
55
     *
56
     * @var array
57
     */
58
    protected $rawBlocks = [];
59
60
61
62
    public function compileFileName($fileName, $model) {
63
        $parsed = $this->compileString($fileName);
64
        ob_start();
65
        eval( '?>' . $parsed );
66
        $output = ob_get_contents();
67
        ob_end_clean();
68
        return $output;
69
    }
70
71
    public function compileFile($filePath, $model)
72
    {
73
        return Code::file($filePath)->with(['model'=>$model])->render();
74
    }
75
}