Completed
Push — master ( 1ce981...0b7883 )
by Tom
02:21
created
src/FilePath.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
     }
13 13
 
14 14
     public function getFilePath($filePath = "") {
15
-		if (isset($filePath[0]) && $filePath[0] == "/") return $this->customBase . $filePath;
16
-		else return $this->baseDir . $filePath;
15
+		if (isset($filePath[0]) && $filePath[0] == "/") return $this->customBase.$filePath;
16
+		else return $this->baseDir.$filePath;
17 17
 	}
18 18
 }
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,12 +7,18 @@
 block discarded – undo
7 7
 
8 8
     public function __construct(&$baseDir, $customBase = null) {
9 9
         $this->baseDir = &$baseDir;
10
-        if ($customBase === null) $this->customBase = getcwd();
11
-        else $this->customBase = rtrim($customBase, '/');
10
+        if ($customBase === null) {
11
+        	$this->customBase = getcwd();
12
+        } else {
13
+        	$this->customBase = rtrim($customBase, '/');
14
+        }
12 15
     }
13 16
 
14 17
     public function getFilePath($filePath = "") {
15
-		if (isset($filePath[0]) && $filePath[0] == "/") return $this->customBase . $filePath;
16
-		else return $this->baseDir . $filePath;
18
+		if (isset($filePath[0]) && $filePath[0] == "/") {
19
+			return $this->customBase . $filePath;
20
+		} else {
21
+			return $this->baseDir . $filePath;
22
+		}
17 23
 	}
18 24
 }
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -2,16 +2,16 @@
 block discarded – undo
2 2
 namespace Transphporm;
3 3
 
4 4
 class FilePath {
5
-    private $baseDir;
6
-    private $customBase;
5
+	private $baseDir;
6
+	private $customBase;
7 7
 
8
-    public function __construct(&$baseDir, $customBase = null) {
9
-        $this->baseDir = &$baseDir;
10
-        if ($customBase === null) $this->customBase = getcwd();
11
-        else $this->customBase = rtrim($customBase, '/');
12
-    }
8
+	public function __construct(&$baseDir, $customBase = null) {
9
+		$this->baseDir = &$baseDir;
10
+		if ($customBase === null) $this->customBase = getcwd();
11
+		else $this->customBase = rtrim($customBase, '/');
12
+	}
13 13
 
14
-    public function getFilePath($filePath = "") {
14
+	public function getFilePath($filePath = "") {
15 15
 		if (isset($filePath[0]) && $filePath[0] == "/") return $this->customBase . $filePath;
16 16
 		else return $this->baseDir . $filePath;
17 17
 	}
Please login to merge, or discard this patch.
src/Hook/PseudoMatcher.php 1 patch
Braces   +16 added lines, -9 removed lines patch added patch discarded remove patch
@@ -27,9 +27,10 @@  discard block
 block discarded – undo
27 27
 				try {
28 28
 					$parts = $this->getFuncParts($tokens);
29 29
 					$matches = $function->match($parts['name'], $parts['args'], $element);
30
-					if ($matches === false) return false;
31
-				}
32
-				catch (\Exception $e) {
30
+					if ($matches === false) {
31
+						return false;
32
+					}
33
+				} catch (\Exception $e) {
33 34
 					throw new \Transphporm\RunException(\Transphporm\Exception::PSEUDO, $parts['name'], $e);
34 35
 				}
35 36
 			}
@@ -42,31 +43,37 @@  discard block
 block discarded – undo
42 43
 		$parts['name'] = $this->getFuncName($tokens);
43 44
 		if ($parts['name'] === null || in_array($parts['name'], ['data', 'iteration', 'root'])) {
44 45
 			$parts['args'] = $this->valueParser->parseTokens($tokens);
45
-		}
46
-		else if (count($tokens) > 1) {
46
+		} else if (count($tokens) > 1) {
47 47
 			$tokens->rewind();
48 48
 			$tokens->next();
49 49
 			$parts['args'] = $this->valueParser->parseTokens($tokens->current()['value']);
50
+		} else {
51
+			$parts['args'] = [['']];
50 52
 		}
51
-		else $parts['args'] = [['']];
52 53
 		return $parts;
53 54
 	}
54 55
 
55 56
 	private function getFuncName($tokens) {
56
-		if ($tokens->type() === Tokenizer::NAME) return $tokens->read();
57
+		if ($tokens->type() === Tokenizer::NAME) {
58
+			return $tokens->read();
59
+		}
57 60
 		return null;
58 61
 	}
59 62
 
60 63
 	public function hasFunction($name) {
61 64
 		foreach ($this->pseudo as $tokens) {
62
-			if ($name === $this->getFuncName($tokens)) return true;
65
+			if ($name === $this->getFuncName($tokens)) {
66
+				return true;
67
+			}
63 68
 		}
64 69
 	}
65 70
 
66 71
 	public function getFuncArgs($name) {
67 72
 		foreach ($this->pseudo as $tokens) {
68 73
 			$parts = $this->getFuncParts($tokens);
69
-			if ($name === $parts['name']) return $parts['args'];
74
+			if ($name === $parts['name']) {
75
+				return $parts['args'];
76
+			}
70 77
 		}
71 78
 	}
72 79
 }
Please login to merge, or discard this patch.
src/Property/Repeat.php 2 patches
Doc Comments   +12 added lines patch added patch discarded remove patch
@@ -10,6 +10,9 @@  discard block
 block discarded – undo
10 10
 	private $elementData;
11 11
 	private $line;
12 12
 
13
+	/**
14
+	 * @param integer $line
15
+	 */
13 16
 	public function __construct(\Transphporm\FunctionSet $functionSet, \Transphporm\Hook\ElementData $elementData, &$line) {
14 17
 		$this->functionSet = $functionSet;
15 18
 		$this->elementData = $elementData;
@@ -58,6 +61,12 @@  discard block
 block discarded – undo
58 61
 		return $value;
59 62
 	}
60 63
 
64
+	/**
65
+	 * @param \DOMElement $element
66
+	 * @param integer $count
67
+	 *
68
+	 * @return \DOMElement
69
+	 */
61 70
 	private function cloneElement($element, $iteration, $key, $count) {
62 71
 		$clone = $element->cloneNode(true);
63 72
 		$this->tagElement($clone, $count);
@@ -77,6 +86,9 @@  discard block
 block discarded – undo
77 86
 		return isset($values[1]) ? $values[1] : PHP_INT_MAX;
78 87
 	}
79 88
 
89
+	/**
90
+	 * @param \Transphporm\Hook\PseudoMatcher $pseudoMatcher
91
+	 */
80 92
 	private function createHook($newRules, $pseudoMatcher, $properties) {
81 93
 		$var = ""; // PropertyHook requires that baseDir be passed by refrence
82 94
 		// and there is no reason to pass it so create $var to avoid errors
Please login to merge, or discard this patch.
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -18,7 +18,9 @@  discard block
 block discarded – undo
18 18
 
19 19
 	public function run(array $values, \DomElement $element, array $rules, \Transphporm\Hook\PseudoMatcher $pseudoMatcher, array $properties = []) {
20 20
 		$values = $this->fixEmpty($values);
21
-		if ($element->getAttribute('transphporm') === 'added') return $element->parentNode->removeChild($element);
21
+		if ($element->getAttribute('transphporm') === 'added') {
22
+			return $element->parentNode->removeChild($element);
23
+		}
22 24
 		$max = $this->getMax($values);
23 25
 		$count = 0;
24 26
 
@@ -29,7 +31,9 @@  discard block
 block discarded – undo
29 31
 		$hook = $this->createHook($rules, $pseudoMatcher, $properties);
30 32
 
31 33
 		foreach ($repeat as $key => $iteration) {
32
-			if ($count+1 > $max) break;
34
+			if ($count+1 > $max) {
35
+				break;
36
+			}
33 37
 			$clone = $this->cloneElement($element, $iteration, $key, $count++);
34 38
 			//Re-run the hook on the new element, but use the iterated data
35 39
 			$hook->run($clone);
@@ -41,8 +45,9 @@  discard block
 block discarded – undo
41 45
 
42 46
 	private function getRepeatValue($values, &$max) {
43 47
 		$mode = $this->getMode($values);
44
-		if ($mode === 'each') $repeat = $values[0];
45
-		else if ($mode === 'loop') {
48
+		if ($mode === 'each') {
49
+			$repeat = $values[0];
50
+		} else if ($mode === 'loop') {
46 51
 			$repeat = range($values[0], $max);
47 52
 			$max++;
48 53
 		}
@@ -54,7 +59,9 @@  discard block
 block discarded – undo
54 59
 	}
55 60
 
56 61
 	private function fixEmpty($value) {
57
-		if (empty($value[0])) $value[0] = [];
62
+		if (empty($value[0])) {
63
+			$value[0] = [];
64
+		}
58 65
 		return $value;
59 66
 	}
60 67
 
@@ -70,7 +77,9 @@  discard block
 block discarded – undo
70 77
 
71 78
 	private function tagElement($element, $count) {
72 79
 		//Mark all but one of the nodes as having been added by transphporm, when the hook is run again, these are removed
73
-		if ($count > 0) $element->setAttribute('transphporm', 'added');
80
+		if ($count > 0) {
81
+			$element->setAttribute('transphporm', 'added');
82
+		}
74 83
 	}
75 84
 
76 85
 	private function getMax($values) {
@@ -81,7 +90,9 @@  discard block
 block discarded – undo
81 90
 		$var = ""; // PropertyHook requires that baseDir be passed by refrence
82 91
 		// and there is no reason to pass it so create $var to avoid errors
83 92
 		$hook = new \Transphporm\Hook\PropertyHook($newRules, $var, $this->line, "", $this->line, $pseudoMatcher, new \Transphporm\Parser\Value($this->functionSet), $this->functionSet);
84
-		foreach ($properties as $name => $property) $hook->registerProperty($name, $property);
93
+		foreach ($properties as $name => $property) {
94
+			$hook->registerProperty($name, $property);
95
+		}
85 96
 		return $hook;
86 97
 	}
87 98
 }
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   +22 added lines, -9 removed lines patch added patch discarded remove patch
@@ -14,8 +14,11 @@  discard block
 block discarded – undo
14 14
 	}
15 15
 
16 16
 	public function traverse($key) {
17
-		if (isset($this->data->{$key})) $this->data = $this->data->{$key};
18
-		else if ($this->isArray() && isset($this->data[$key])) $this->data = $this->data[$key];
17
+		if (isset($this->data->{$key})) {
18
+			$this->data = $this->data->{$key};
19
+		} else if ($this->isArray() && isset($this->data[$key])) {
20
+			$this->data = $this->data[$key];
21
+		}
19 22
 	}
20 23
 
21 24
 	private function isArray() {
@@ -24,10 +27,14 @@  discard block
 block discarded – undo
24 27
 
25 28
 	public function read($value) {
26 29
 		if ($this->isArray()) {
27
-			if (isset($this->data[$value])) return $this->data[$value];
30
+			if (isset($this->data[$value])) {
31
+				return $this->data[$value];
32
+			}
33
+		} else if (isset($this->data->$value)) {
34
+			return $this->data->$value;
35
+		} else {
36
+			return false;
28 37
 		}
29
-		else if (isset($this->data->$value)) return $this->data->$value;
30
-		else return false;
31 38
 	}
32 39
 
33 40
 	public function call($func, $args) {
@@ -40,14 +47,20 @@  discard block
 block discarded – undo
40 47
 
41 48
 	public function parseNested($parser, $token, $funcName) {
42 49
 		$args = $parser->parseTokens($token['value'], $this->data);
43
-		if ($args[0] == $this->data) $args = [];
50
+		if ($args[0] == $this->data) {
51
+			$args = [];
52
+		}
44 53
 		return $this->callFuncOnObject($this->data, $funcName, $args);
45 54
 	}
46 55
 
47 56
 	private function callFuncOnObject($obj, $func, $args) {
48
-		if (isset($obj->$func) && is_callable($obj->$func)) return call_user_func_array($obj->$func, $args);
49
-		else if (is_callable([$obj, $func])) return call_user_func_array([$obj, $func], $args);
50
-		else return false;
57
+		if (isset($obj->$func) && is_callable($obj->$func)) {
58
+			return call_user_func_array($obj->$func, $args);
59
+		} else if (is_callable([$obj, $func])) {
60
+			return call_user_func_array([$obj, $func], $args);
61
+		} else {
62
+			return false;
63
+		}
51 64
 	}
52 65
 
53 66
 	public function extract($last, $autoLookup, $traversing) {
Please login to merge, or discard this patch.
src/Parser/ValueResult.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,10 +31,11 @@
 block discarded – undo
31 31
 		];
32 32
 
33 33
 		if ($funcs[$this->mode] === 'concat' && is_numeric($newValue)
34
-			&& is_numeric($this->result[count($this->result)-1]))
35
-			$this->add($newValue);
36
-		else
37
-			$this->{$funcs[$this->mode]}($newValue);
34
+			&& is_numeric($this->result[count($this->result)-1])) {
35
+					$this->add($newValue);
36
+		} else {
37
+					$this->{$funcs[$this->mode]}($newValue);
38
+		}
38 39
 	}
39 40
 
40 41
 	public function arg($value) {
Please login to merge, or discard this patch.
src/Formatter/HTMLFormatter.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -7,6 +7,9 @@
 block discarded – undo
7 7
         $this->templateFunction = $templateFunction;
8 8
     }
9 9
 
10
+    /**
11
+     * @param string $val
12
+     */
10 13
     public function html($val) {
11 14
 		return $this->templateFunction->run(['<template>' . $val . '</template>']);
12 15
 	}
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Transphporm\Formatter;
3 3
 class HTMLFormatter {
4
-    private $templateFunction;
4
+	private $templateFunction;
5 5
 
6
-    public function __construct(\Transphporm\TSSFunction\Template $templateFunction) {
7
-        $this->templateFunction = $templateFunction;
8
-    }
6
+	public function __construct(\Transphporm\TSSFunction\Template $templateFunction) {
7
+		$this->templateFunction = $templateFunction;
8
+	}
9 9
 
10
-    public function html($val) {
10
+	public function html($val) {
11 11
 		return $this->templateFunction->run(['<template>' . $val . '</template>']);
12 12
 	}
13 13
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@
 block discarded – undo
8 8
     }
9 9
 
10 10
     public function html($val) {
11
-		return $this->templateFunction->run(['<template>' . $val . '</template>']);
11
+		return $this->templateFunction->run(['<template>'.$val.'</template>']);
12 12
 	}
13 13
 
14 14
 	public function debug($val) {
15 15
 		ob_start();
16 16
 		var_dump($val);
17
-		return $this->html('<pre>' . ob_get_clean() . '</pre>');
17
+		return $this->html('<pre>'.ob_get_clean().'</pre>');
18 18
 	}
19 19
 }
Please login to merge, or discard this patch.
src/Property/Content.php 2 patches
Doc Comments   +16 added lines patch added patch discarded remove patch
@@ -28,6 +28,9 @@  discard block
 block discarded – undo
28 28
 		}
29 29
 	}
30 30
 
31
+	/**
32
+	 * @param \DOMElement $element
33
+	 */
31 34
 	private function shouldRun($element) {
32 35
 		do {
33 36
 			if ($element->getAttribute('transphporm') == 'includedtemplate') return false;
@@ -40,6 +43,10 @@  discard block
 block discarded – undo
40 43
 		return (isset($rules['content-mode'])) ? $rules['content-mode']->read() : 'append';
41 44
 	}
42 45
 
46
+	/**
47
+	 * @param \DOMElement $element
48
+	 * @param \Transphporm\Hook\PseudoMatcher $pseudoMatcher
49
+	 */
43 50
 	private function processPseudo($value, $element, $pseudoMatcher) {
44 51
 		$pseudoContent = ['attr', 'header', 'before', 'after'];
45 52
 		foreach ($pseudoContent as $pseudo) {
@@ -101,6 +108,9 @@  discard block
 block discarded – undo
101 108
 		}
102 109
 	}
103 110
 
111
+	/**
112
+	 * @param \DOMElement $element
113
+	 */
104 114
 	private function replaceContent($element, $content) {
105 115
 		//If this rule was cached, the elements that were added last time need to be removed prior to running the rule again.
106 116
 		foreach ($this->getNode($content, $element->ownerDocument) as $node) {
@@ -109,12 +119,18 @@  discard block
 block discarded – undo
109 119
 		$element->setAttribute('transphporm', 'remove');
110 120
 	}
111 121
 
122
+	/**
123
+	 * @param \DOMElement $element
124
+	 */
112 125
 	private function appendContent($element, $content) {
113 126
 		foreach ($this->getNode($content, $element->ownerDocument) as $node) {
114 127
 			$element->appendChild($node);
115 128
 		}
116 129
 	}
117 130
 
131
+	/**
132
+	 * @param \DOMElement $element
133
+	 */
118 134
 	private function removeAllChildren($element) {
119 135
 		while ($element->hasChildNodes()) $element->removeChild($element->firstChild);
120 136
 	}
Please login to merge, or discard this patch.
Braces   +22 added lines, -11 removed lines patch added patch discarded remove patch
@@ -15,7 +15,9 @@  discard block
 block discarded – undo
15 15
 	}
16 16
 
17 17
 	public function run(array $values, \DomElement $element, array $rules, \Transphporm\Hook\PseudoMatcher $pseudoMatcher, array $properties = []) {
18
-		if (!$this->shouldRun($element)) return false;
18
+		if (!$this->shouldRun($element)) {
19
+			return false;
20
+		}
19 21
 
20 22
 		$values = $this->formatter->format($values, $rules);
21 23
 
@@ -23,14 +25,19 @@  discard block
 block discarded – undo
23 25
 			//Remove the current contents
24 26
 			$this->removeAllChildren($element);
25 27
 			//Now make a text node
26
-			if ($this->getContentMode($rules) === 'replace') $this->replaceContent($element, $values);
27
-			else $this->appendContent($element, $values);
28
+			if ($this->getContentMode($rules) === 'replace') {
29
+				$this->replaceContent($element, $values);
30
+			} else {
31
+				$this->appendContent($element, $values);
32
+			}
28 33
 		}
29 34
 	}
30 35
 
31 36
 	private function shouldRun($element) {
32 37
 		do {
33
-			if ($element->getAttribute('transphporm') == 'includedtemplate') return false;
38
+			if ($element->getAttribute('transphporm') == 'includedtemplate') {
39
+				return false;
40
+			}
34 41
 		}
35 42
 		while (($element = $element->parentNode) instanceof \DomElement);
36 43
 		return true;
@@ -54,9 +61,10 @@  discard block
 block discarded – undo
54 61
 	private function getNode($node, $document) {
55 62
 		foreach ($node as $n) {
56 63
 			if (is_array($n)) {
57
-				foreach ($this->getNode($n, $document) as $new) yield $new;
58
-			}
59
-			else {
64
+				foreach ($this->getNode($n, $document) as $new) {
65
+					yield $new;
66
+				}
67
+			} else {
60 68
 				yield $this->convertNode($n, $document);
61 69
 			}
62 70
 		}
@@ -67,9 +75,10 @@  discard block
 block discarded – undo
67 75
 			$new = $document->importNode($node, true);
68 76
 			//Removing this might cause problems with caching...
69 77
 			//$new->setAttribute('transphporm', 'added');
70
-		}
71
-		else {
72
-			if ($node instanceof \DomText) $node = $node->nodeValue;
78
+		} else {
79
+			if ($node instanceof \DomText) {
80
+				$node = $node->nodeValue;
81
+			}
73 82
 			$new = $document->createElement('text');
74 83
 
75 84
 			$new->appendChild($document->createTextNode($node));
@@ -116,6 +125,8 @@  discard block
 block discarded – undo
116 125
 	}
117 126
 
118 127
 	private function removeAllChildren($element) {
119
-		while ($element->hasChildNodes()) $element->removeChild($element->firstChild);
128
+		while ($element->hasChildNodes()) {
129
+			$element->removeChild($element->firstChild);
130
+		}
120 131
 	}
121 132
 }
Please login to merge, or discard this patch.
src/Parser/Value.php 1 patch
Braces   +23 added lines, -18 removed lines patch added patch discarded remove patch
@@ -54,7 +54,9 @@  discard block
 block discarded – undo
54 54
 		$this->last = null;
55 55
 		$this->traversing = false;
56 56
 
57
-		if (count($tokens) <= 0) return [$data];
57
+		if (count($tokens) <= 0) {
58
+			return [$data];
59
+		}
58 60
 
59 61
 		foreach (new TokenFilterIterator($tokens, [Tokenizer::WHITESPACE, Tokenizer::NEW_LINE]) as $token) {
60 62
 			$this->{$this->tokenFuncs[$token['type']]}($token);
@@ -76,16 +78,16 @@  discard block
 block discarded – undo
76 78
 	//Reads the last selected value from $data regardless if it's an array or object and overrides $this->data with the new value
77 79
 	//Dot moves $data to the next object in $data foo.bar moves the $data pointer from `foo` to `bar`
78 80
 	private function processDot($token) {
79
-		if ($this->last !== null) $this->data->traverse($this->last);
80
-		else {
81
+		if ($this->last !== null) {
82
+			$this->data->traverse($this->last);
83
+		} else {
81 84
 			//When . is not preceeded by anything, treat it as part of the string instead of an operator
82 85
 			// foo.bar is treated as looking up `bar` in `foo` whereas .foo is treated as the string ".foo"
83 86
 			$lastResult = $this->result->pop();
84 87
 			if ($lastResult) {
85 88
 				$this->data = new ValueData($lastResult);
86 89
 				$this->traversing = true;
87
-			}
88
-			else {
90
+			} else {
89 91
 				$this->processString(['value' => '.']);
90 92
 				$this->result->setMode(Tokenizer::CONCAT);
91 93
 			}
@@ -98,15 +100,19 @@  discard block
 block discarded – undo
98 100
 		$parser = new Value($this->baseData, $this->autoLookup);
99 101
 		if ($this->baseData instanceof \Transphporm\Functionset && $this->baseData->hasFunction($this->last)) {
100 102
 			$this->callTransphpormFunctions($token);
101
-		}
102
-		else {
103
-			if ($this->last !== null) $this->data->traverse($this->last);
104
-			else {
103
+		} else {
104
+			if ($this->last !== null) {
105
+				$this->data->traverse($this->last);
106
+			} else {
105 107
 				$lastResult = $this->result->pop();
106
-				if ($lastResult) $this->data = new ValueData($lastResult);
108
+				if ($lastResult) {
109
+					$this->data = new ValueData($lastResult);
110
+				}
107 111
 			}
108 112
 			$this->last = $parser->parseTokens($token['value'], null)[0];
109
-			if (!is_bool($this->last)) $this->traversing = true;
113
+			if (!is_bool($this->last)) {
114
+				$this->traversing = true;
115
+			}
110 116
 		}
111 117
 	}
112 118
 
@@ -126,8 +132,7 @@  discard block
 block discarded – undo
126 132
 		if ($this->baseData instanceof \Transphporm\Functionset && $this->baseData->hasFunction($this->last)
127 133
 			&& !$this->data->methodExists($this->last)) {
128 134
 			$this->callTransphpormFunctions($token);
129
-		}
130
-		else {
135
+		} else {
131 136
 			$this->processNested($token);
132 137
 		}
133 138
 	}
@@ -144,7 +149,9 @@  discard block
 block discarded – undo
144 149
 		foreach ($this->result->getResult() as $i => $value) {
145 150
 			if (is_scalar($value)) {
146 151
 				$val = $this->data->read($value);
147
-				if ($val) $this->result[$i] = $val;
152
+				if ($val) {
153
+					$this->result[$i] = $val;
154
+				}
148 155
 			}
149 156
 		}
150 157
 		$this->last = null;
@@ -156,12 +163,10 @@  discard block
 block discarded – undo
156 163
 			try {
157 164
 				$value = $this->data->extract($this->last, $this->autoLookup, $this->traversing);
158 165
 				$this->result->processValue($value);
159
-			}
160
-			catch (\UnexpectedValueException $e) {
166
+			} catch (\UnexpectedValueException $e) {
161 167
 				if (!($this->autoLookup || $this->traversing)) {
162 168
 					$this->result->processValue($this->last);
163
-				}
164
-				else {
169
+				} else {
165 170
 					$this->result->clear();
166 171
 					$this->result[0] = false;
167 172
 				}
Please login to merge, or discard this patch.
src/Module/Format.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@
 block discarded – undo
15 15
 
16 16
 	private function getLocale() {
17 17
 		if (is_array($this->locale)) return $this->locale;
18
-		else if (strlen($this->locale) > 0) return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '../Formatter' . DIRECTORY_SEPARATOR . 'Locale' . DIRECTORY_SEPARATOR . $this->locale . '.json'), true);
19
-		else return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '../Formatter' . DIRECTORY_SEPARATOR . 'Locale' . DIRECTORY_SEPARATOR . 'enGB.json'), true);
18
+		else if (strlen($this->locale) > 0) return json_decode(file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'../Formatter'.DIRECTORY_SEPARATOR.'Locale'.DIRECTORY_SEPARATOR.$this->locale.'.json'), true);
19
+		else return json_decode(file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'../Formatter'.DIRECTORY_SEPARATOR.'Locale'.DIRECTORY_SEPARATOR.'enGB.json'), true);
20 20
 	}
21 21
 
22 22
 	public function load(\Transphporm\Config $config) {
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,9 +14,13 @@
 block discarded – undo
14 14
 	}
15 15
 
16 16
 	private function getLocale() {
17
-		if (is_array($this->locale)) return $this->locale;
18
-		else if (strlen($this->locale) > 0) return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '../Formatter' . DIRECTORY_SEPARATOR . 'Locale' . DIRECTORY_SEPARATOR . $this->locale . '.json'), true);
19
-		else return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '../Formatter' . DIRECTORY_SEPARATOR . 'Locale' . DIRECTORY_SEPARATOR . 'enGB.json'), true);
17
+		if (is_array($this->locale)) {
18
+			return $this->locale;
19
+		} else if (strlen($this->locale) > 0) {
20
+			return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '../Formatter' . DIRECTORY_SEPARATOR . 'Locale' . DIRECTORY_SEPARATOR . $this->locale . '.json'), true);
21
+		} else {
22
+			return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '../Formatter' . DIRECTORY_SEPARATOR . 'Locale' . DIRECTORY_SEPARATOR . 'enGB.json'), true);
23
+		}
20 24
 	}
21 25
 
22 26
 	public function load(\Transphporm\Config $config) {
Please login to merge, or discard this patch.