GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( f9c1aa...ebbda5 )
by Steeven
19:04 queued 02:32
created

Blade::parse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of the O2System Framework package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @author         Steeve Andrian Salim
9
 * @copyright      Copyright (c) Steeve Andrian Salim
10
 */
11
12
// ------------------------------------------------------------------------
13
14
namespace O2System\Parser\Template\Adapters;
15
16
// ------------------------------------------------------------------------
17
18
use O2System\Parser\Template\Abstracts\AbstractAdapter;
19
use O2System\Spl\Exceptions\RuntimeException;
20
21
/**
22
 * Class Blade
23
 *
24
 * This class driver for Laravel's Blade Template Engine for O2System PHP Framework templating system.
25
 *
26
 * @package O2System\Parser\Template\Adapters
27
 */
28
class Blade extends AbstractAdapter
29
{
30
    /**
31
     * Blade::initialize
32
     *
33
     * @param array $config
34
     *
35
     * @return static
36
     * @throws \O2System\Spl\Exceptions\RuntimeException
37
     */
38
    public function initialize(array $config = [])
39
    {
40
        $config = array_merge($this->config, $config);
41
42
        if (empty($this->engine)) {
43
            if ($this->isSupported()) {
44
                $this->engine = new \O2System\Parser\Template\Engines\Blade($config);
45
            } else {
46
                throw new RuntimeException('PARSER_E_THIRD_PARTY', 0, ['\O2System\Parser\Engines\Blade']);
47
            }
48
        }
49
50
        return $this;
51
    }
52
53
    // ------------------------------------------------------------------------
54
55
    /**
56
     * Blade::isSupported
57
     *
58
     * Checks if this template engine is supported on this system.
59
     *
60
     * @return bool
61
     */
62
    public function isSupported()
63
    {
64
        if (class_exists('\O2System\Parser\Template\Engines\Blade')) {
65
            return true;
66
        }
67
68
        return false;
69
    }
70
71
    // ------------------------------------------------------------------------
72
73
    /**
74
     * Blade::parse
75
     *
76
     * @param array $vars Variable to be parsed.
77
     *
78
     * @return string
79
     */
80
    public function parse(array $vars = [])
81
    {
82
        return $this->engine->parseString($this->string, $vars);
83
    }
84
85
    // ------------------------------------------------------------------------
86
87
    /**
88
     * Blade::isValidEngine
89
     *
90
     * Checks if is a valid Object Engine.
91
     *
92
     * @param object $engine Engine Object Resource.
93
     *
94
     * @return bool
95
     */
96
    protected function isValidEngine($engine)
97
    {
98
        if ($engine instanceof \O2System\Parser\Template\Engines\Blade) {
99
            return true;
100
        }
101
102
        return false;
103
    }
104
}