Completed
Push — master ( 2adaf5...166020 )
by George
05:35 queued 03:32
created

VibroCompiler::compileFileName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 2
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
12
use Ghaskell\Scaffold\Facades\Vibro;
13
use Illuminate\Support\Facades\View;
14
use Illuminate\View\Compilers\BladeCompiler;
15
16
17
class VibroCompiler extends BladeCompiler
18
{
19
20
    /**
21
     * Array of opening and closing tags for raw echos.
22
     *
23
     * @var array
24
     */
25
    protected $rawTags = ['<%%', '%%>'];
26
27
28
    /**
29
     * Array of opening and closing tags for regular echos.
30
     *
31
     * @var array
32
     */
33
    protected $contentTags = ['<%', '%>'];
34
35
    /**
36
     * Array of opening and closing tags for escaped echos.
37
     *
38
     * @var array
39
     */
40
    protected $escapedTags = ['<%%%', '%%%>'];
41
42
    /**
43
     * The "regular" / legacy echo string format.
44
     *
45
     * @var string
46
     */
47
    protected $echoFormat = 'e(%s)';
48
49
    /**
50
     * Array of footer lines to be added to template.
51
     *
52
     * @var array
53
     */
54
    protected $footer = [];
55
56
    /**
57
     * Array to temporary store the raw blocks found in the template.
58
     *
59
     * @var array
60
     */
61
    protected $rawBlocks = [];
62
63
64
65
    public function compileFileName($fileName, $args) {
66
        extract($args);
67
        $parsed = $this->compileString($fileName);
68
        ob_start();
69
        eval( '?>' . $parsed );
0 ignored issues
show
introduced by
The use of eval() is discouraged.
Loading history...
70
        $output = ob_get_contents();
71
        ob_end_clean();
72
        return $output;
73
    }
74
75
    public function compileFile($filePath, $args)
76
    {
77
        return Code::file($filePath, $args)->with($args)->render();
78
    }
79
}