Completed
Pull Request — master (#155)
by Garrett
03:12
created
src/Config.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,12 +67,16 @@
 block discarded – undo
67 67
 	}
68 68
 
69 69
 	public function loadProperties(Hook\PropertyHook $hook) {
70
-		foreach ($this->properties as $name => $property) $hook->registerProperty($name, $property);
70
+		foreach ($this->properties as $name => $property) {
71
+			$hook->registerProperty($name, $property);
72
+		}
71 73
 	}
72 74
 
73 75
 	public function createPseudoMatcher($pseudo) {
74 76
 		$pseudoMatcher = new Hook\PseudoMatcher($pseudo, $this->valueParser);
75
-		foreach ($this->pseudo as $pseudoFunction) $pseudoMatcher->registerFunction(clone $pseudoFunction);
77
+		foreach ($this->pseudo as $pseudoFunction) {
78
+			$pseudoMatcher->registerFunction(clone $pseudoFunction);
79
+		}
76 80
 		return $pseudoMatcher;
77 81
 	}
78 82
 
Please login to merge, or discard this patch.
src/Parser/TokenFilterIterator.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -6,39 +6,39 @@
 block discarded – undo
6 6
  * @version         1.0                                                             */
7 7
 namespace Transphporm\Parser;
8 8
 class TokenFilterIterator implements \Iterator {
9
-    private $ignore;
10
-    private $tokens;
9
+	private $ignore;
10
+	private $tokens;
11 11
 
12
-    public function __construct(Tokens $tokens, array $ignore) {
13
-        $this->ignore = $ignore;
14
-        $this->tokens = $tokens;
15
-    }
12
+	public function __construct(Tokens $tokens, array $ignore) {
13
+		$this->ignore = $ignore;
14
+		$this->tokens = $tokens;
15
+	}
16 16
 
17
-    public function current() {
18
-        return $this->tokens->current();
19
-    }
17
+	public function current() {
18
+		return $this->tokens->current();
19
+	}
20 20
 
21
-    public function key() {
22
-        return $this->tokens->key();
23
-    }
21
+	public function key() {
22
+		return $this->tokens->key();
23
+	}
24 24
 
25
-    public function valid() {
26
-        return $this->tokens->valid();
27
-    }
25
+	public function valid() {
26
+		return $this->tokens->valid();
27
+	}
28 28
 
29
-    public function next() {
30
-        do {
31
-            $this->tokens->next();
32
-        }
33
-        while ($this->shouldContinue());
34
-    }
29
+	public function next() {
30
+		do {
31
+			$this->tokens->next();
32
+		}
33
+		while ($this->shouldContinue());
34
+	}
35 35
 
36
-    public function rewind() {
37
-        $this->tokens->rewind();
38
-        while ($this->shouldContinue()) $this->tokens->next();
39
-    }
36
+	public function rewind() {
37
+		$this->tokens->rewind();
38
+		while ($this->shouldContinue()) $this->tokens->next();
39
+	}
40 40
 
41
-    private function shouldContinue() {
42
-        return $this->tokens->valid() && in_array($this->tokens->current()['type'], $this->ignore);
43
-    }
41
+	private function shouldContinue() {
42
+		return $this->tokens->valid() && in_array($this->tokens->current()['type'], $this->ignore);
43
+	}
44 44
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@
 block discarded – undo
35 35
 
36 36
     public function rewind() {
37 37
         $this->tokens->rewind();
38
-        while ($this->shouldContinue()) $this->tokens->next();
38
+        while ($this->shouldContinue()) {
39
+        	$this->tokens->next();
40
+        }
39 41
     }
40 42
 
41 43
     private function shouldContinue() {
Please login to merge, or discard this patch.
src/Builder.php 3 patches
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -62,6 +62,10 @@  discard block
 block discarded – undo
62 62
 		return (object) $result;
63 63
 	}
64 64
 
65
+	/**
66
+	 * @param Template $template
67
+	 * @param Config $config
68
+	 */
65 69
 	private function processRules($template, $config) {
66 70
 		$rules = $this->getRules($template, $config);
67 71
 
@@ -71,6 +75,10 @@  discard block
 block discarded – undo
71 75
 	}
72 76
 
73 77
 	//Add a postprocessing hook. This cleans up anything transphporm has added to the markup which needs to be removed
78
+
79
+	/**
80
+	 * @param Template $template
81
+	 */
74 82
 	private function doPostProcessing($template) {
75 83
 		$template->addHook('//*[@transphporm]', new Hook\PostProcess());
76 84
 		return $template;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
 
54 54
 		$cachedOutput = $this->loadTemplate();
55 55
 		//To be a valid XML document it must have a root element, automatically wrap it in <template> to ensure it does
56
-		$template = new Template($this->isValidDoc($cachedOutput['body']) ? str_ireplace('<!doctype', '<!DOCTYPE', $cachedOutput['body']) : '<template>' . $cachedOutput['body'] . '</template>' );
56
+		$template = new Template($this->isValidDoc($cachedOutput['body']) ? str_ireplace('<!doctype', '<!DOCTYPE', $cachedOutput['body']) : '<template>'.$cachedOutput['body'].'</template>');
57 57
 		$valueParser = new Parser\Value($functionSet);
58 58
 		$this->config = new Config($functionSet, $valueParser, $elementData, new Hook\Formatter(), new Parser\CssToXpath($functionSet, $template->getPrefix(), md5($this->tss)), $this->filePath, $headers);
59 59
 
Please login to merge, or discard this patch.
Braces   +14 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,7 +28,9 @@  discard block
 block discarded – undo
28 28
 		$this->cache = new Cache(new \ArrayObject());
29 29
 		$this->filePath = new FilePath();
30 30
 		$modules = is_array($modules) ? $modules : $this->defaultModules;
31
-		foreach ($modules as $module) $this->loadModule(new $module);
31
+		foreach ($modules as $module) {
32
+			$this->loadModule(new $module);
33
+		}
32 34
 	}
33 35
 
34 36
 	//Allow setting the time used by Transphporm for caching. This is for testing purposes
@@ -57,7 +59,9 @@  discard block
 block discarded – undo
57 59
 		$valueParser = new Parser\Value($functionSet);
58 60
 		$this->config = new Config($functionSet, $valueParser, $elementData, new Hook\Formatter(), new Parser\CssToXpath($functionSet, $template->getPrefix(), md5($this->tss)), $this->filePath, $headers);
59 61
 
60
-		foreach ($this->modules as $module) $module->load($this->config);
62
+		foreach ($this->modules as $module) {
63
+			$module->load($this->config);
64
+		}
61 65
 
62 66
 		$this->processRules($template, $this->config);
63 67
 
@@ -71,7 +75,9 @@  discard block
 block discarded – undo
71 75
 		$rules = $this->getRules($template, $config);
72 76
 
73 77
 		foreach ($rules as $rule) {
74
-			if ($rule->shouldRun($this->time)) $this->executeTssRule($rule, $template, $config);
78
+			if ($rule->shouldRun($this->time)) {
79
+				$this->executeTssRule($rule, $template, $config);
80
+			}
75 81
 		}
76 82
 	}
77 83
 
@@ -96,8 +102,9 @@  discard block
 block discarded – undo
96 102
 		if (trim($this->template)[0] !== '<') {
97 103
 			$xml = $this->cache->load($this->template, filemtime($this->template));
98 104
 			return $xml ? $xml : ['body' => file_get_contents($this->template), 'headers' => []];
105
+		} else {
106
+			return ['body' => $this->template, 'headers' => []];
99 107
 		}
100
-		else return ['body' => $this->template, 'headers' => []];
101 108
 	}
102 109
 
103 110
 	//Load the TSS rules either from a file or as a string
@@ -117,6 +124,8 @@  discard block
 block discarded – undo
117 124
 
118 125
 	public function __destruct() {
119 126
 		//Required hack as DomXPath can only register static functions clear, the statically stored instance to avoid memory leaks
120
-		if (isset($this->config)) $this->config->getCssToXpath()->cleanup();
127
+		if (isset($this->config)) {
128
+			$this->config->getCssToXpath()->cleanup();
129
+		}
121 130
 	}
122 131
 }
Please login to merge, or discard this patch.
src/RunException.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Transphporm;
3 3
 class RunException extends \Exception {
4
-    public function __construct($operationType, $operationName, \Exception $previous) {
5
-        $message = 'TSS Error: Problem carrying out ' . $operationType . ' \'' . $operationName . '\'';
4
+	public function __construct($operationType, $operationName, \Exception $previous) {
5
+		$message = 'TSS Error: Problem carrying out ' . $operationType . ' \'' . $operationName . '\'';
6 6
 
7
-        parent::__construct($message, 0, $previous);
8
-    }
7
+		parent::__construct($message, 0, $previous);
8
+	}
9 9
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 namespace Transphporm;
3 3
 class RunException extends \Exception {
4 4
     public function __construct($operationType, $operationName, \Exception $previous) {
5
-        $message = 'TSS Error: Problem carrying out ' . $operationType . ' \'' . $operationName . '\'';
5
+        $message = 'TSS Error: Problem carrying out '.$operationType.' \''.$operationName.'\'';
6 6
 
7 7
         parent::__construct($message, 0, $previous);
8 8
     }
Please login to merge, or discard this patch.
src/Exception.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Transphporm;
3 3
 class Exception extends \Exception {
4
-    const PROPERTY = 'property';
5
-    const TSS_FUNCTION = 'function';
6
-    const PSEUDO = 'pseudo';
7
-    const FORMATTER = 'formatter';
4
+	const PROPERTY = 'property';
5
+	const TSS_FUNCTION = 'function';
6
+	const PSEUDO = 'pseudo';
7
+	const FORMATTER = 'formatter';
8 8
 
9
-    public function __construct(RunException $runException, $file, $line) {
10
-        $message = $runException->getMessage() . ' on Line ' . $line . ' of ' . ($file === null ? 'tss' : $file);
9
+	public function __construct(RunException $runException, $file, $line) {
10
+		$message = $runException->getMessage() . ' on Line ' . $line . ' of ' . ($file === null ? 'tss' : $file);
11 11
 
12
-        parent::__construct($message, 0, $runException->getPrevious());
13
-    }
12
+		parent::__construct($message, 0, $runException->getPrevious());
13
+	}
14 14
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
     const FORMATTER = 'formatter';
8 8
 
9 9
     public function __construct(RunException $runException, $file, $line) {
10
-        $message = $runException->getMessage() . ' on Line ' . $line . ' of ' . ($file === null ? 'tss' : $file);
10
+        $message = $runException->getMessage().' on Line '.$line.' of '.($file === null ? 'tss' : $file);
11 11
 
12 12
         parent::__construct($message, 0, $runException->getPrevious());
13 13
     }
Please login to merge, or discard this patch.
src/TSSCache.php 3 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace Transphporm;
3 3
 class TSSCache {
4
-    private $cache;
5
-    private $prefix;
4
+	private $cache;
5
+	private $prefix;
6 6
 
7
-    public function __construct(Cache $cache, $prefix) {
8
-        $this->cache = $cache;
9
-        $this->prefix = $prefix;
10
-    }
7
+	public function __construct(Cache $cache, $prefix) {
8
+		$this->cache = $cache;
9
+		$this->prefix = $prefix;
10
+	}
11 11
 
12 12
 	private function getRulesFromCache($file) {
13 13
 		//The cache for the key: the filename and template prefix
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
 		return $file . $this->prefix . dirname(realpath($file)) . DIRECTORY_SEPARATOR;
29 29
 	}
30 30
 
31
-    public function load($tss) {
32
-        return $this->getRulesFromCache($tss);
33
-    }
31
+	public function load($tss) {
32
+		return $this->getRulesFromCache($tss);
33
+	}
34 34
 
35
-    public function write($file, $rules, $imports = []) {
36
-        if (is_file($file)) $this->cache->write($this->getCacheKey($file), ['rules' => $rules, 'import' => $imports]);
37
-        return $rules;
38
-    }
35
+	public function write($file, $rules, $imports = []) {
36
+		if (is_file($file)) $this->cache->write($this->getCacheKey($file), ['rules' => $rules, 'import' => $imports]);
37
+		return $rules;
38
+	}
39 39
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 	}
26 26
 
27 27
 	private function getCacheKey($file) {
28
-		return $file . $this->prefix . dirname(realpath($file)) . DIRECTORY_SEPARATOR;
28
+		return $file.$this->prefix.dirname(realpath($file)).DIRECTORY_SEPARATOR;
29 29
 	}
30 30
 
31 31
     public function load($tss) {
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,9 @@  discard block
 block discarded – undo
18 18
 		$rules = $this->cache->load($key, filemtime($file));
19 19
 		if ($rules) {
20 20
 			foreach ($rules['import'] as $file) {
21
-				if (!$this->cache->load($this->getCacheKey($file), filemtime($file))) return false;
21
+				if (!$this->cache->load($this->getCacheKey($file), filemtime($file))) {
22
+					return false;
23
+				}
22 24
 			}
23 25
 		}
24 26
 		return $rules;
@@ -33,7 +35,9 @@  discard block
 block discarded – undo
33 35
     }
34 36
 
35 37
     public function write($file, $rules, $imports = []) {
36
-        if (is_file($file)) $this->cache->write($this->getCacheKey($file), ['rules' => $rules, 'import' => $imports]);
38
+        if (is_file($file)) {
39
+        	$this->cache->write($this->getCacheKey($file), ['rules' => $rules, 'import' => $imports]);
40
+        }
37 41
         return $rules;
38 42
     }
39 43
 }
Please login to merge, or discard this patch.
src/TSSFunction/Template.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -17,6 +17,9 @@
 block discarded – undo
17 17
 		$this->xPath = $xPath;
18 18
 	}
19 19
 
20
+	/**
21
+	 * @param integer $index
22
+	 */
20 23
 	private function readArray($array, $index) {
21 24
 		return isset($array[$index]) ? $array[$index] : null;
22 25
 	}
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
 	private function getTemplateContent($newNode, $tss) {
41 41
 		$result = [];
42 42
 		foreach ($newNode->childNodes as $node) {
43
-            if (isset($node->tagName) && $node->tagName === 'template') $result[] = $this->getTemplateContent($node, $tss);
43
+			if (isset($node->tagName) && $node->tagName === 'template') $result[] = $this->getTemplateContent($node, $tss);
44 44
 			else $result[] = $this->getClonedElement($node, $tss);
45 45
 		}
46 46
 		return $result;
Please login to merge, or discard this patch.
Braces   +16 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,13 +25,18 @@  discard block
 block discarded – undo
25 25
 		$selector = $this->readArray($args, 1);
26 26
 		$tss = $this->readArray($args, 2);
27 27
 
28
-		if (trim($args[0])[0] === '<') $xml = $args[0];
29
-		else $xml = $this->filePath->getFilePath($args[0]);
28
+		if (trim($args[0])[0] === '<') {
29
+			$xml = $args[0];
30
+		} else {
31
+			$xml = $this->filePath->getFilePath($args[0]);
32
+		}
30 33
 
31 34
 		$newTemplate = new \Transphporm\Builder($xml, $tss ? $this->filePath->getFilePath($tss) : null);
32 35
 
33 36
 		$doc = $newTemplate->output($this->elementData->getData($element), true)->body;
34
-		if ($selector != '') return $this->templateSubsection($doc, $selector);
37
+		if ($selector != '') {
38
+			return $this->templateSubsection($doc, $selector);
39
+		}
35 40
 
36 41
 		return $this->getTemplateContent($doc->documentElement, $tss);
37 42
 	}
@@ -39,8 +44,11 @@  discard block
 block discarded – undo
39 44
 	private function getTemplateContent($newNode, $tss) {
40 45
 		$result = [];
41 46
 		foreach ($newNode->childNodes as $node) {
42
-            if (isset($node->tagName) && $node->tagName === 'template') $result[] = $this->getTemplateContent($node, $tss);
43
-			else $result[] = $this->getClonedElement($node, $tss);
47
+            if (isset($node->tagName) && $node->tagName === 'template') {
48
+            	$result[] = $this->getTemplateContent($node, $tss);
49
+            } else {
50
+				$result[] = $this->getClonedElement($node, $tss);
51
+			}
44 52
 		}
45 53
 		return $result;
46 54
 	}
@@ -59,7 +67,9 @@  discard block
 block discarded – undo
59 67
 
60 68
 	private function getClonedElement($node, $tss) {
61 69
 		$clone = $node->cloneNode(true);
62
-		if ($tss != null && $clone instanceof \DomElement) $clone->setAttribute('transphporm', 'includedtemplate');
70
+		if ($tss != null && $clone instanceof \DomElement) {
71
+			$clone->setAttribute('transphporm', 'includedtemplate');
72
+		}
63 73
 		return $clone;
64 74
 	}
65 75
 }
Please login to merge, or discard this patch.
src/TSSFunction/Json.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@
 block discarded – undo
12 12
 
13 13
         if ($this->isJsonFile($json)) {
14 14
             $path = $this->filePath->getFilePath($json);
15
-            if (!file_exists($path)) throw new \Exception('File does not exist at: ' . $path);
15
+            if (!file_exists($path)) throw new \Exception('File does not exist at: '.$path);
16 16
             $json = file_get_contents($path);
17 17
         }
18 18
 
19 19
         $map = json_decode($json, true);
20 20
 
21
-        if (!is_array($map)) throw new \Exception('Could not decode json: ' . json_last_error_msg());
21
+        if (!is_array($map)) throw new \Exception('Could not decode json: '.json_last_error_msg());
22 22
 
23 23
         return $map;
24 24
     }
Please login to merge, or discard this patch.
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,29 +1,29 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Transphporm\TSSFunction;
3 3
 class Json implements \Transphporm\TSSFunction {
4
-    private $filePath;
4
+	private $filePath;
5 5
 
6
-    public function __construct(\Transphporm\FilePath $filePath) {
7
-        $this->filePath = $filePath;
8
-    }
6
+	public function __construct(\Transphporm\FilePath $filePath) {
7
+		$this->filePath = $filePath;
8
+	}
9 9
 
10
-    public function run(array $args, \DomElement $element = null) {
11
-        $json = $args[0];
10
+	public function run(array $args, \DomElement $element = null) {
11
+		$json = $args[0];
12 12
 
13
-        if ($this->isJsonFile($json)) {
14
-            $path = $this->filePath->getFilePath($json);
15
-            if (!file_exists($path)) throw new \Exception('File does not exist at: ' . $path);
16
-            $json = file_get_contents($path);
17
-        }
13
+		if ($this->isJsonFile($json)) {
14
+			$path = $this->filePath->getFilePath($json);
15
+			if (!file_exists($path)) throw new \Exception('File does not exist at: ' . $path);
16
+			$json = file_get_contents($path);
17
+		}
18 18
 
19
-        $map = json_decode($json, true);
19
+		$map = json_decode($json, true);
20 20
 
21
-        if (!is_array($map)) throw new \Exception('Could not decode json: ' . json_last_error_msg());
21
+		if (!is_array($map)) throw new \Exception('Could not decode json: ' . json_last_error_msg());
22 22
 
23
-        return $map;
24
-    }
23
+		return $map;
24
+	}
25 25
 
26
-    private function isJsonFile($json) {
27
-        return trim($json)[0] != '{' && trim($json)[0] != '[';
28
-    }
26
+	private function isJsonFile($json) {
27
+		return trim($json)[0] != '{' && trim($json)[0] != '[';
28
+	}
29 29
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,13 +12,17 @@
 block discarded – undo
12 12
 
13 13
         if ($this->isJsonFile($json)) {
14 14
             $path = $this->filePath->getFilePath($json);
15
-            if (!file_exists($path)) throw new \Exception('File does not exist at: ' . $path);
15
+            if (!file_exists($path)) {
16
+            	throw new \Exception('File does not exist at: ' . $path);
17
+            }
16 18
             $json = file_get_contents($path);
17 19
         }
18 20
 
19 21
         $map = json_decode($json, true);
20 22
 
21
-        if (!is_array($map)) throw new \Exception('Could not decode json: ' . json_last_error_msg());
23
+        if (!is_array($map)) {
24
+        	throw new \Exception('Could not decode json: ' . json_last_error_msg());
25
+        }
22 26
 
23 27
         return $map;
24 28
     }
Please login to merge, or discard this patch.
src/Parser/ValueData.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 
49 49
 	public function extract($last, $autoLookup, $traversing) {
50 50
 		$value = $this->read($last);
51
-		if ($value && ($autoLookup || $traversing) ) {
51
+		if ($value && ($autoLookup || $traversing)) {
52 52
 			return $value;
53 53
 		}
54 54
 		throw new \UnexpectedValueException('Not found');
Please login to merge, or discard this patch.
Braces   +25 added lines, -11 removed lines patch added patch discarded remove patch
@@ -15,13 +15,17 @@  discard block
 block discarded – undo
15 15
 
16 16
 	//Read $key from array, $this->data = $this->data[$key] but also works for objects
17 17
 	private function traverseInto($key) {
18
-		if (isset($this->data->{$key})) $this->data = $this->data->{$key};
19
-		else if ($this->isArray() && isset($this->data[$key])) $this->data = $this->data[$key];
18
+		if (isset($this->data->{$key})) {
19
+			$this->data = $this->data->{$key};
20
+		} else if ($this->isArray() && isset($this->data[$key])) {
21
+			$this->data = $this->data[$key];
22
+		}
20 23
 	}
21 24
 
22 25
 	public function traverse($key, $result) {
23
-		if ($key !== null) $this->traverseInto($key);
24
-		else {
26
+		if ($key !== null) {
27
+			$this->traverseInto($key);
28
+		} else {
25 29
 			//But if the key is null, replace the data structure with the result of the last function call
26 30
 			$lastResult = $result->pop();
27 31
 			if ($lastResult) {
@@ -37,10 +41,14 @@  discard block
 block discarded – undo
37 41
 
38 42
 	public function read($value) {
39 43
 		if ($this->isArray()) {
40
-			if (isset($this->data[$value])) return $this->data[$value];
44
+			if (isset($this->data[$value])) {
45
+				return $this->data[$value];
46
+			}
47
+		} else if (isset($this->data->$value)) {
48
+			return $this->data->$value;
49
+		} else {
50
+			return null;
41 51
 		}
42
-		else if (isset($this->data->$value)) return $this->data->$value;
43
-		else return null;
44 52
 	}
45 53
 
46 54
 	public function call($func, $args) {
@@ -53,14 +61,20 @@  discard block
 block discarded – undo
53 61
 
54 62
 	public function parseNested($parser, $token, $funcName) {
55 63
 		$args = $parser->parseTokens($token['value'], $this->data);
56
-		if ($args[0] == $this->data) $args = [];
64
+		if ($args[0] == $this->data) {
65
+			$args = [];
66
+		}
57 67
 		return $this->callFuncOnObject($this->data, $funcName, $args);
58 68
 	}
59 69
 
60 70
 	private function callFuncOnObject($obj, $func, $args) {
61
-		if (isset($obj->$func) && is_callable($obj->$func)) return call_user_func_array($obj->$func, $args);
62
-		else if (is_callable([$obj, $func])) return call_user_func_array([$obj, $func], $args);
63
-		else return false;
71
+		if (isset($obj->$func) && is_callable($obj->$func)) {
72
+			return call_user_func_array($obj->$func, $args);
73
+		} else if (is_callable([$obj, $func])) {
74
+			return call_user_func_array([$obj, $func], $args);
75
+		} else {
76
+			return false;
77
+		}
64 78
 	}
65 79
 
66 80
 	public function extract($last, $autoLookup, $traversing) {
Please login to merge, or discard this patch.