@@ -102,16 +102,16 @@ discard block |
||
102 | 102 | $this->config = $config; |
103 | 103 | |
104 | 104 | if ($this->config->offsetExists('template')) { |
105 | - if(is_array($this->config->template)) { |
|
106 | - foreach($this->config->template as $engine) { |
|
105 | + if (is_array($this->config->template)) { |
|
106 | + foreach ($this->config->template as $engine) { |
|
107 | 107 | $this->template->load($engine); |
108 | 108 | } |
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | 112 | if ($this->config->offsetExists('string')) { |
113 | - if(is_array($this->config->string)) { |
|
114 | - foreach($this->config->string as $engine) { |
|
113 | + if (is_array($this->config->string)) { |
|
114 | + foreach ($this->config->string as $engine) { |
|
115 | 115 | $this->string->load($engine); |
116 | 116 | } |
117 | 117 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | */ |
257 | 257 | public function parsePhp(array $vars = []) |
258 | 258 | { |
259 | - if(count($vars)) { |
|
259 | + if (count($vars)) { |
|
260 | 260 | $this->loadVars($vars); |
261 | 261 | } |
262 | 262 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | $inString = 0; |
333 | 333 | foreach (token_get_all('<?php ' . $sourceCode) as $token) { |
334 | 334 | if (is_array($token)) { |
335 | - switch ($token[ 0 ]) { |
|
335 | + switch ($token[0]) { |
|
336 | 336 | case T_CURLY_OPEN: |
337 | 337 | case T_DOLLAR_OPEN_CURLY_BRACES: |
338 | 338 | case T_START_HEREDOC: |
@@ -390,10 +390,10 @@ discard block |
||
390 | 390 | $sourceCode = ob_get_clean(); |
391 | 391 | $sourceCode = strip_tags($sourceCode); |
392 | 392 | if (preg_match("'syntax error, (.+) in .+ on line (\d+)$'s", $sourceCode, $sourceCode)) { |
393 | - $sourceCode[ 2 ] = (int)$sourceCode[ 2 ]; |
|
394 | - $sourceCode = $sourceCode[ 2 ] <= $braces |
|
395 | - ? [$sourceCode[ 1 ], $sourceCode[ 2 ]] |
|
396 | - : ['unexpected $end' . substr($sourceCode[ 1 ], 14), $braces]; |
|
393 | + $sourceCode[2] = (int)$sourceCode[2]; |
|
394 | + $sourceCode = $sourceCode[2] <= $braces |
|
395 | + ? [$sourceCode[1], $sourceCode[2]] |
|
396 | + : ['unexpected $end' . substr($sourceCode[1], 14), $braces]; |
|
397 | 397 | } else { |
398 | 398 | $sourceCode = ['syntax error', 0]; |
399 | 399 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | * @return static |
36 | 36 | * @throws \O2System\Spl\Exceptions\RuntimeException |
37 | 37 | */ |
38 | - public function initialize(array $config =[]) |
|
38 | + public function initialize(array $config = []) |
|
39 | 39 | { |
40 | 40 | if (empty($this->engine)) { |
41 | 41 | if ($this->isSupported()) { |
@@ -97,14 +97,14 @@ |
||
97 | 97 | { |
98 | 98 | $output = $string; |
99 | 99 | |
100 | - if(is_file($string)) { |
|
100 | + if (is_file($string)) { |
|
101 | 101 | $output = file_get_contents($string); |
102 | 102 | } |
103 | 103 | |
104 | - if($this->count()) { |
|
105 | - foreach($this->registry as $adapter) { |
|
106 | - if($adapter instanceof Abstracts\AbstractAdapter) { |
|
107 | - if($adapter->isSupported()) { |
|
104 | + if ($this->count()) { |
|
105 | + foreach ($this->registry as $adapter) { |
|
106 | + if ($adapter instanceof Abstracts\AbstractAdapter) { |
|
107 | + if ($adapter->isSupported()) { |
|
108 | 108 | $adapter->initialize(); |
109 | 109 | $adapter->loadString($output); |
110 | 110 | $output = $adapter->parse($vars); |
@@ -90,7 +90,7 @@ |
||
90 | 90 | public function setEngine($engine) |
91 | 91 | { |
92 | 92 | if ($this->isValidEngine($engine)) { |
93 | - $this->engine =& $engine; |
|
93 | + $this->engine = & $engine; |
|
94 | 94 | |
95 | 95 | return true; |
96 | 96 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function load($engine, array $config = []) |
75 | 75 | { |
76 | - if(class_exists($adapter = '\O2System\Parser\String\Adapters\\' . $engine)) { |
|
76 | + if (class_exists($adapter = '\O2System\Parser\String\Adapters\\' . $engine)) { |
|
77 | 77 | $this->register((new $adapter())->setConfig($config), $adapter); |
78 | 78 | |
79 | 79 | return $this->__isset($adapter); |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | { |
97 | 97 | $output = $string; |
98 | 98 | |
99 | - if(is_file($string)) { |
|
99 | + if (is_file($string)) { |
|
100 | 100 | $output = file_get_contents($string); |
101 | 101 | } |
102 | 102 | |
103 | - if($this->count()) { |
|
104 | - foreach($this->registry as $adapter) { |
|
105 | - if($adapter instanceof Abstracts\AbstractAdapter) { |
|
106 | - if($adapter->isSupported()) { |
|
103 | + if ($this->count()) { |
|
104 | + foreach ($this->registry as $adapter) { |
|
105 | + if ($adapter instanceof Abstracts\AbstractAdapter) { |
|
106 | + if ($adapter->isSupported()) { |
|
107 | 107 | $adapter->initialize(); |
108 | 108 | $adapter->loadString($output); |
109 | 109 | $output = $adapter->parse($vars); |