Completed
Push — master ( 0cacf9...8a12d1 )
by Tom
01:41
created
src/FilePath.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,15 +14,15 @@
 block discarded – undo
14 14
 
15 15
 	public function getFilePath($filePath) {
16 16
 		if (is_file($filePath)) return $filePath;
17
-		else if (is_file($this->baseDir . DIRECTORY_SEPARATOR . $filePath)) return $this->baseDir . DIRECTORY_SEPARATOR . $filePath;
17
+		else if (is_file($this->baseDir.DIRECTORY_SEPARATOR.$filePath)) return $this->baseDir.DIRECTORY_SEPARATOR.$filePath;
18 18
 		else return $this->loadFromPaths($filePath);
19 19
 	}
20 20
 
21 21
 	private function loadFromPaths($filePath) {
22 22
 		foreach ($this->paths as $path) {
23
-			if (is_file($path . DIRECTORY_SEPARATOR . $filePath)) return $path . DIRECTORY_SEPARATOR . $filePath;
23
+			if (is_file($path.DIRECTORY_SEPARATOR.$filePath)) return $path.DIRECTORY_SEPARATOR.$filePath;
24 24
 		}
25 25
 
26
-		throw new \Exception($filePath . ' not found in include path: ' . implode(';', $this->paths));
26
+		throw new \Exception($filePath.' not found in include path: '.implode(';', $this->paths));
27 27
 	}
28 28
 }
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,14 +13,20 @@
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	public function getFilePath($filePath) {
16
-		if (is_file($filePath)) return $filePath;
17
-		else if (is_file($this->baseDir . DIRECTORY_SEPARATOR . $filePath)) return $this->baseDir . DIRECTORY_SEPARATOR . $filePath;
18
-		else return $this->loadFromPaths($filePath);
16
+		if (is_file($filePath)) {
17
+			return $filePath;
18
+		} else if (is_file($this->baseDir . DIRECTORY_SEPARATOR . $filePath)) {
19
+			return $this->baseDir . DIRECTORY_SEPARATOR . $filePath;
20
+		} else {
21
+			return $this->loadFromPaths($filePath);
22
+		}
19 23
 	}
20 24
 
21 25
 	private function loadFromPaths($filePath) {
22 26
 		foreach ($this->paths as $path) {
23
-			if (is_file($path . DIRECTORY_SEPARATOR . $filePath)) return $path . DIRECTORY_SEPARATOR . $filePath;
27
+			if (is_file($path . DIRECTORY_SEPARATOR . $filePath)) {
28
+				return $path . DIRECTORY_SEPARATOR . $filePath;
29
+			}
24 30
 		}
25 31
 
26 32
 		throw new \Exception($filePath . ' not found in include path: ' . implode(';', $this->paths));
Please login to merge, or discard this patch.
src/Parser/Last.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,9 +53,9 @@
 block discarded – undo
53 53
 		$this->last = $value;
54 54
 	}
55 55
 
56
-    public function makeTraversing() {
57
-        $this->traversing = true;
58
-    }
56
+	public function makeTraversing() {
57
+		$this->traversing = true;
58
+	}
59 59
 
60 60
 	//Applies the current operation to whatever is in $last based on $mode
61 61
 	public function process() {
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -63,8 +63,7 @@  discard block
 block discarded – undo
63 63
 			try {
64 64
 				$value = $this->data->extract($this->last, $this->autoLookup, $this->traversing);
65 65
 				$this->result->processValue($value);
66
-			}
67
-			catch (\UnexpectedValueException $e) {
66
+			} catch (\UnexpectedValueException $e) {
68 67
 				$this->processLastUnexpected();
69 68
 			}
70 69
 		}
@@ -73,8 +72,7 @@  discard block
 block discarded – undo
73 72
 	private function processLastUnexpected() {
74 73
 		if (!($this->autoLookup || $this->traversing)) {
75 74
 			$this->result->processValue($this->last);
76
-		}
77
-		else {
75
+		} else {
78 76
 			$this->result->clear();
79 77
 			$this->result->processValue(false);
80 78
 		}
Please login to merge, or discard this patch.
src/Parser/Value.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -148,7 +148,7 @@
 block discarded – undo
148 148
 		}
149 149
 		else $parsedVal = null;
150 150
         
151
-        $this->result->postProcess($this->data, $val, $parsedVal, $this->allowNullResult);
151
+		$this->result->postProcess($this->data, $val, $parsedVal, $this->allowNullResult);
152 152
 
153 153
 		$this->last->clear();
154 154
 	}
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@
 block discarded – undo
85 85
 		if ($lastResult) {
86 86
 			$this->last->makeTraversing();
87 87
 		}
88
-		else if ($this->last->isEmpty())  {
88
+		else if ($this->last->isEmpty()) {
89 89
 			$this->processString(['value' => '.']);
90 90
 			$this->result->setMode(Tokenizer::CONCAT);
91 91
 		}
Please login to merge, or discard this patch.
Braces   +11 added lines, -9 removed lines patch added patch discarded remove patch
@@ -56,7 +56,9 @@  discard block
 block discarded – undo
56 56
 		$this->last = new Last($this->data, $this->result, $this->autoLookup);
57 57
 		$this->traversing = false;
58 58
 
59
-		if (count($tokens) <= 0) return [$data];
59
+		if (count($tokens) <= 0) {
60
+			return [$data];
61
+		}
60 62
 
61 63
 		foreach (new TokenFilterIterator($tokens, [Tokenizer::WHITESPACE, Tokenizer::NEW_LINE]) as $token) {
62 64
 			$this->{$this->tokenFuncs[$token['type']]}($token);
@@ -84,8 +86,7 @@  discard block
 block discarded – undo
84 86
 		// foo.bar is treated as looking up `bar` in `foo` whereas .foo is treated as the string ".foo"
85 87
 		if ($lastResult) {
86 88
 			$this->last->makeTraversing();
87
-		}
88
-		else if ($this->last->isEmpty())  {
89
+		} else if ($this->last->isEmpty())  {
89 90
 			$this->processString(['value' => '.']);
90 91
 			$this->result->setMode(Tokenizer::CONCAT);
91 92
 		}
@@ -100,11 +101,12 @@  discard block
 block discarded – undo
100 101
 	private function processSquareBracket($token) {
101 102
 		if ($this->hasFunction($this->last->read())) {
102 103
 			$this->callTransphpormFunctions($token);
103
-		}
104
-		else {
104
+		} else {
105 105
 			$this->last->traverse();
106 106
 			$this->last->set($this->getNewParser()->parseTokens($token['value'], null)[0]);
107
-			if (!is_bool($this->last->read())) $this->last->makeTraversing();
107
+			if (!is_bool($this->last->read())) {
108
+				$this->last->makeTraversing();
109
+			}
108 110
 		}
109 111
 	}
110 112
 
@@ -127,8 +129,7 @@  discard block
 block discarded – undo
127 129
 		if ($this->hasFunction($this->last->read())
128 130
 			&& !$this->data->methodExists($this->last->read())) {
129 131
 			$this->callTransphpormFunctions($token);
130
-		}
131
-		else {
132
+		} else {
132 133
 			$this->last->processNested($this->getNewParser(), $token);
133 134
 		}
134 135
 	}
@@ -145,8 +146,9 @@  discard block
 block discarded – undo
145 146
 			$parser = new Value($this->data->getData());
146 147
 			$parsedArr = $parser->parse($val);
147 148
 			$parsedVal = isset($parsedArr[0]) ? $parsedArr[0] : null;
149
+		} else {
150
+			$parsedVal = null;
148 151
 		}
149
-		else $parsedVal = null;
150 152
         
151 153
         $this->result->postProcess($this->data, $val, $parsedVal, $this->allowNullResult);
152 154
 
Please login to merge, or discard this patch.
src/Property/Content.php 1 patch
Braces   +22 added lines, -11 removed lines patch added patch discarded remove patch
@@ -14,7 +14,9 @@  discard block
 block discarded – undo
14 14
 	}
15 15
 
16 16
 	public function run(array $values, \DomElement $element, array $rules, \Transphporm\Hook\PseudoMatcher $pseudoMatcher, array $properties = []) {
17
-		if (!$this->shouldRun($element)) return false;
17
+		if (!$this->shouldRun($element)) {
18
+			return false;
19
+		}
18 20
 
19 21
 		$values = $this->formatter->format($values, $rules);
20 22
 
@@ -22,14 +24,19 @@  discard block
 block discarded – undo
22 24
 			//Remove the current contents
23 25
 			$this->removeAllChildren($element);
24 26
 			//Now make a text node
25
-			if ($this->getContentMode($rules) === 'replace') $this->replaceContent($element, $values);
26
-			else $this->appendContent($element, $values);
27
+			if ($this->getContentMode($rules) === 'replace') {
28
+				$this->replaceContent($element, $values);
29
+			} else {
30
+				$this->appendContent($element, $values);
31
+			}
27 32
 		}
28 33
 	}
29 34
 
30 35
 	private function shouldRun($element) {
31 36
 		do {
32
-			if ($element->getAttribute('transphporm') == 'includedtemplate') return false;
37
+			if ($element->getAttribute('transphporm') == 'includedtemplate') {
38
+				return false;
39
+			}
33 40
 		}
34 41
 		while (($element = $element->parentNode) instanceof \DomElement);
35 42
 		return true;
@@ -56,9 +63,10 @@  discard block
 block discarded – undo
56 63
 	public function getNode($node, $document) {
57 64
 		foreach ($node as $n) {
58 65
 			if (is_array($n)) {
59
-				foreach ($this->getNode($n, $document) as $new) yield $new;
60
-			}
61
-			else {
66
+				foreach ($this->getNode($n, $document) as $new) {
67
+					yield $new;
68
+				}
69
+			} else {
62 70
 				yield $this->convertNode($n, $document);
63 71
 			}
64 72
 		}
@@ -69,9 +77,10 @@  discard block
 block discarded – undo
69 77
 			$new = $document->importNode($node, true);
70 78
 			//Removing this might cause problems with caching...
71 79
 			//$new->setAttribute('transphporm', 'added');
72
-		}
73
-		else {
74
-			if ($node instanceof \DomText) $node = $node->nodeValue;
80
+		} else {
81
+			if ($node instanceof \DomText) {
82
+				$node = $node->nodeValue;
83
+			}
75 84
 			$new = $document->createElement('text');
76 85
 
77 86
 			$new->appendChild($document->createTextNode($node));
@@ -95,6 +104,8 @@  discard block
 block discarded – undo
95 104
 	}
96 105
 
97 106
 	private function removeAllChildren($element) {
98
-		while ($element->hasChildNodes()) $element->removeChild($element->firstChild);
107
+		while ($element->hasChildNodes()) {
108
+			$element->removeChild($element->firstChild);
109
+		}
99 110
 	}
100 111
 }
Please login to merge, or discard this patch.
src/Config.php 2 patches
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -68,7 +68,9 @@  discard block
 block discarded – undo
68 68
 	}
69 69
 
70 70
     public function registerContentPseudo($name, Property\ContentPseudo $pseudo) {
71
-        if (isset($this->properties['content'])) $this->properties['content']->addContentPseudo($name, $pseudo);
71
+        if (isset($this->properties['content'])) {
72
+        	$this->properties['content']->addContentPseudo($name, $pseudo);
73
+        }
72 74
     }
73 75
 
74 76
 	public function registerPseudo(Pseudo $pseudo) {
@@ -76,12 +78,16 @@  discard block
 block discarded – undo
76 78
 	}
77 79
 
78 80
 	public function loadProperties(Hook\PropertyHook $hook) {
79
-		foreach ($this->properties as $name => $property) $hook->registerProperty($name, $property);
81
+		foreach ($this->properties as $name => $property) {
82
+			$hook->registerProperty($name, $property);
83
+		}
80 84
 	}
81 85
 
82 86
 	public function createPseudoMatcher($pseudo) {
83 87
 		$pseudoMatcher = new Hook\PseudoMatcher($pseudo, $this->valueParser);
84
-		foreach ($this->pseudo as $pseudoFunction) $pseudoMatcher->registerFunction(clone $pseudoFunction);
88
+		foreach ($this->pseudo as $pseudoFunction) {
89
+			$pseudoMatcher->registerFunction(clone $pseudoFunction);
90
+		}
85 91
 		return $pseudoMatcher;
86 92
 	}
87 93
 
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	}
41 41
 
42 42
 	public function &getLine() {
43
-        $line = &$this->line;
43
+		$line = &$this->line;
44 44
 		return $line;
45 45
 	}
46 46
 
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
 		$this->properties[$name] = $property;
69 69
 	}
70 70
 
71
-    public function registerContentPseudo($name, Property\ContentPseudo $pseudo) {
72
-        if (isset($this->properties['content'])) $this->properties['content']->addContentPseudo($name, $pseudo);
73
-    }
71
+	public function registerContentPseudo($name, Property\ContentPseudo $pseudo) {
72
+		if (isset($this->properties['content'])) $this->properties['content']->addContentPseudo($name, $pseudo);
73
+	}
74 74
 
75 75
 	public function registerPseudo(Pseudo $pseudo) {
76 76
 		$this->pseudo[] = $pseudo;
Please login to merge, or discard this patch.
src/Parser/Tokenizer.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -98,6 +98,9 @@
 block discarded – undo
98 98
 		}
99 99
 	}
100 100
 
101
+	/**
102
+	 * @param integer $n
103
+	 */
101 104
 	private function isLiteral($n) {
102 105
 		//Is it a normal literal character
103 106
 		return isset($this->str[$n]) && ($this->identifyChar($this->str[$n]) == self::NAME
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@
 block discarded – undo
144 144
 		if ($char === self::STRING) {
145 145
 			$string = $this->extractString($i);
146 146
 			$length = strlen($string)+1;
147
-			$string = str_replace('\\' . $this->str[$i], $this->str[$i], $string);
147
+			$string = str_replace('\\'.$this->str[$i], $this->str[$i], $string);
148 148
 			$tokens[] = ['type' => self::STRING, 'value' => $string, 'line' => $this->lineNo];
149 149
 			return $length;
150 150
 		}
Please login to merge, or discard this patch.
Braces   +30 added lines, -12 removed lines patch added patch discarded remove patch
@@ -83,8 +83,11 @@  discard block
 block discarded – undo
83 83
 			$i += $this->doBrackets($tokens, $char, $i);
84 84
 
85 85
 		}
86
-		if ($returnObj) return new Tokens($tokens);
87
-		else return $tokens;
86
+		if ($returnObj) {
87
+			return new Tokens($tokens);
88
+		} else {
89
+			return $tokens;
90
+		}
88 91
 	}
89 92
 
90 93
 	private function doSingleLineComments(&$tokens, $char, $i) {
@@ -135,10 +138,15 @@  discard block
 block discarded – undo
135 138
 	}
136 139
 
137 140
 	private function processLiterals(&$tokens, $name) {
138
-		if (is_numeric($name)) $tokens[] = ['type' => self::NUMERIC, 'value' => $name];
139
-		else if ($name == 'true') $tokens[] = ['type' => self::BOOL, 'value' => true];
140
-		else if ($name == 'false') $tokens[] = ['type' => self::BOOL, 'value' => false];
141
-		else $tokens[] = ['type' => self::NAME, 'value' => $name, 'line' => $this->lineNo];
141
+		if (is_numeric($name)) {
142
+			$tokens[] = ['type' => self::NUMERIC, 'value' => $name];
143
+		} else if ($name == 'true') {
144
+			$tokens[] = ['type' => self::BOOL, 'value' => true];
145
+		} else if ($name == 'false') {
146
+			$tokens[] = ['type' => self::BOOL, 'value' => false];
147
+		} else {
148
+			$tokens[] = ['type' => self::NAME, 'value' => $name, 'line' => $this->lineNo];
149
+		}
142 150
 	}
143 151
 
144 152
 	private function doBrackets(&$tokens, $char, $i) {
@@ -171,7 +179,9 @@  discard block
 block discarded – undo
171 179
 	private function extractString($pos) {
172 180
 		$char = $this->str[$pos];
173 181
 		$end = strpos($this->str, $char, $pos+1);
174
-		while ($end !== false && $this->str[$end-1] == '\\') $end = strpos($this->str, $char, $end+1);
182
+		while ($end !== false && $this->str[$end-1] == '\\') {
183
+			$end = strpos($this->str, $char, $end+1);
184
+		}
175 185
 
176 186
 		return substr($this->str, $pos+1, $end-$pos-1);
177 187
 	}
@@ -180,18 +190,26 @@  discard block
 block discarded – undo
180 190
 		$close = strpos($this->str, $closeBracket, $open);
181 191
 
182 192
 		$cPos = $open+1;
183
-		while (($cPos = strpos($this->str, $startBracket, $cPos+1)) !== false && $cPos < $close) $close = strpos($this->str, $closeBracket, $close+1);
193
+		while (($cPos = strpos($this->str, $startBracket, $cPos+1)) !== false && $cPos < $close) {
194
+			$close = strpos($this->str, $closeBracket, $close+1);
195
+		}
184 196
 		return substr($this->str, $open+1, $close-$open-1);
185 197
 	}
186 198
 
187 199
 	private function identifyChar($chr) {
188
-		if (isset($this->chars[$chr])) return $this->chars[$chr];
189
-		else return self::NAME;
200
+		if (isset($this->chars[$chr])) {
201
+			return $this->chars[$chr];
202
+		} else {
203
+			return self::NAME;
204
+		}
190 205
 	}
191 206
 
192 207
 	private function getChar($num) {
193 208
 		$chars = array_reverse($this->chars);
194
-		if (isset($chars[$num])) return $chars[$num];
195
-		else return false;
209
+		if (isset($chars[$num])) {
210
+			return $chars[$num];
211
+		} else {
212
+			return false;
213
+		}
196 214
 	}
197 215
 }
Please login to merge, or discard this patch.
src/Template.php 2 patches
Braces   +14 added lines, -5 removed lines patch added patch discarded remove patch
@@ -66,7 +66,9 @@  discard block
 block discarded – undo
66 66
 	/** Loops through all assigned hooks, runs the Xpath query and calls the hook */
67 67
 	private function processHooks() {
68 68
 		foreach ($this->hooks as list($query, $hook)) {
69
-			foreach ($this->xpath->query($query) as $element) $hook->run($element);
69
+			foreach ($this->xpath->query($query) as $element) {
70
+				$hook->run($element);
71
+			}
70 72
 		}
71 73
 		$this->hooks = [];
72 74
 	}
@@ -74,7 +76,9 @@  discard block
 block discarded – undo
74 76
 	/** Prints out the current DomDocument as HTML */
75 77
 	private function printDocument() {
76 78
 		$output = '';
77
-		foreach ($this->document->documentElement->childNodes as $node) $output .= call_user_func($this->save, $node);
79
+		foreach ($this->document->documentElement->childNodes as $node) {
80
+			$output .= call_user_func($this->save, $node);
81
+		}
78 82
 		return $output;
79 83
 	}
80 84
 
@@ -86,13 +90,18 @@  discard block
 block discarded – undo
86 90
 		//Generate the document by taking only the childnodes of the template, ignoring the <template> and </template> tags
87 91
 		//TODO: Is there a faster way of doing this without string manipulation on the output or this loop through childnodes?
88 92
 		 //Either return a whole DomDocument or return the output HTML
89
-		if ($document) return $this->document;
93
+		if ($document) {
94
+			return $this->document;
95
+		}
90 96
 
91 97
 		//Print the doctype... saveHtml inexplicably does not support $doc->doctype as an argument
92 98
 		$output = ($this->document->doctype) ? $this->document->saveXml($this->document->doctype) . "\n" : '';
93 99
 
94
-		if ($this->document->documentElement->tagName !== 'template') $output .= call_user_func($this->save, $this->document->documentElement);
95
-		else $output = $this->printDocument();
100
+		if ($this->document->documentElement->tagName !== 'template') {
101
+			$output .= call_user_func($this->save, $this->document->documentElement);
102
+		} else {
103
+			$output = $this->printDocument();
104
+		}
96 105
 
97 106
 		//repair empty tags. Browsers break on <script /> and <div /> so can't avoid LIBXML_NOEMPTYTAG but they also break on <base></base> so repair them
98 107
 		$output = str_replace(['></img>', '></br>', '></meta>', '></base>', '></link>', '></hr>', '></input>'], ' />', $output);
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 				$this->save = function($content = null) {
38 38
 					return $this->document->saveHtml($content);
39 39
 				};
40
-				$this->document->loadHtml('<' . '?xml encoding="UTF-8">' . $doc,  LIBXML_HTML_NODEFDTD | LIBXML_HTML_NOIMPLIED);
40
+				$this->document->loadHtml('<'.'?xml encoding="UTF-8">'.$doc, LIBXML_HTML_NODEFDTD | LIBXML_HTML_NOIMPLIED);
41 41
 
42 42
 				if (strpos($doc, '<!') !== 0) {
43 43
 					$templateNode = $this->document->getElementsByTagName('template')[0];
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 		if ($document) return $this->document;
90 90
 
91 91
 		//Print the doctype... saveHtml inexplicably does not support $doc->doctype as an argument
92
-		$output = ($this->document->doctype) ? $this->document->saveXml($this->document->doctype) . "\n" : '';
92
+		$output = ($this->document->doctype) ? $this->document->saveXml($this->document->doctype)."\n" : '';
93 93
 
94 94
 		if ($this->document->documentElement->tagName !== 'template') $output .= call_user_func($this->save, $this->document->documentElement);
95 95
 		else $output = $this->printDocument();
Please login to merge, or discard this patch.
src/TSSValidator.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -2,48 +2,48 @@
 block discarded – undo
2 2
 namespace Transphporm;
3 3
 use Transphporm\Parser\Tokenizer;
4 4
 class TSSValidator {
5
-    private $error;
5
+	private $error;
6 6
 
7
-    public function validate($tss) {
8
-        $this->error = null;
9
-        $tokens = $this->tokenize($tss);
7
+	public function validate($tss) {
8
+		$this->error = null;
9
+		$tokens = $this->tokenize($tss);
10 10
 
11
-        foreach ($tokens as $token)
12
-            if (!$this->validateRule($token)) return false;
11
+		foreach ($tokens as $token)
12
+			if (!$this->validateRule($token)) return false;
13 13
 
14
-        return true;
15
-    }
14
+		return true;
15
+	}
16 16
 
17
-    public function getLastError() {
18
-        return $this->error;
19
-    }
17
+	public function getLastError() {
18
+		return $this->error;
19
+	}
20 20
 
21
-    private function validateRule($token) {
22
-        if ($token['type'] !== Tokenizer::OPEN_BRACE) return true;
21
+	private function validateRule($token) {
22
+		if ($token['type'] !== Tokenizer::OPEN_BRACE) return true;
23 23
 
24
-        return $this->checkBraces($token) && $this->checkSemicolons($token)
25
-            && $this->checkParenthesis($token);
26
-    }
24
+		return $this->checkBraces($token) && $this->checkSemicolons($token)
25
+			&& $this->checkParenthesis($token);
26
+	}
27 27
 
28
-    private function checkBraces($token) {
29
-        return strpos($token['string'], '{') === false;
30
-    }
28
+	private function checkBraces($token) {
29
+		return strpos($token['string'], '{') === false;
30
+	}
31 31
 
32
-    private function checkSemicolons($braceToken) {
33
-        $splitTokens = $braceToken['value']->splitOnToken(Tokenizer::COLON);
34
-        array_shift($splitTokens); array_pop($splitTokens);
35
-        foreach ($splitTokens as $tokens)
36
-            if (!in_array(Tokenizer::SEMI_COLON, array_column(iterator_to_array($tokens), 'type'))) return false;
32
+	private function checkSemicolons($braceToken) {
33
+		$splitTokens = $braceToken['value']->splitOnToken(Tokenizer::COLON);
34
+		array_shift($splitTokens); array_pop($splitTokens);
35
+		foreach ($splitTokens as $tokens)
36
+			if (!in_array(Tokenizer::SEMI_COLON, array_column(iterator_to_array($tokens), 'type'))) return false;
37 37
 
38
-        return true;
39
-    }
38
+		return true;
39
+	}
40 40
 
41
-    private function checkParenthesis($token) {
42
-        return substr_count($token['string'], '(') === substr_count($token['string'], ')');
43
-    }
41
+	private function checkParenthesis($token) {
42
+		return substr_count($token['string'], '(') === substr_count($token['string'], ')');
43
+	}
44 44
 
45
-    private function tokenize($tss) {
46
-        if (is_file($tss)) $tss = file_get_contents($tss);
47
-        return (new Parser\Tokenizer($tss))->getTokens();
48
-    }
45
+	private function tokenize($tss) {
46
+		if (is_file($tss)) $tss = file_get_contents($tss);
47
+		return (new Parser\Tokenizer($tss))->getTokens();
48
+	}
49 49
 }
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -8,8 +8,9 @@  discard block
 block discarded – undo
8 8
         $this->error = null;
9 9
         $tokens = $this->tokenize($tss);
10 10
 
11
-        foreach ($tokens as $token)
12
-            if (!$this->validateRule($token)) return false;
11
+        foreach ($tokens as $token) {
12
+                    if (!$this->validateRule($token)) return false;
13
+        }
13 14
 
14 15
         return true;
15 16
     }
@@ -19,7 +20,9 @@  discard block
 block discarded – undo
19 20
     }
20 21
 
21 22
     private function validateRule($token) {
22
-        if ($token['type'] !== Tokenizer::OPEN_BRACE) return true;
23
+        if ($token['type'] !== Tokenizer::OPEN_BRACE) {
24
+        	return true;
25
+        }
23 26
 
24 27
         return $this->checkBraces($token) && $this->checkSemicolons($token)
25 28
             && $this->checkParenthesis($token);
@@ -32,8 +35,9 @@  discard block
 block discarded – undo
32 35
     private function checkSemicolons($braceToken) {
33 36
         $splitTokens = $braceToken['value']->splitOnToken(Tokenizer::COLON);
34 37
         array_shift($splitTokens); array_pop($splitTokens);
35
-        foreach ($splitTokens as $tokens)
36
-            if (!in_array(Tokenizer::SEMI_COLON, array_column(iterator_to_array($tokens), 'type'))) return false;
38
+        foreach ($splitTokens as $tokens) {
39
+                    if (!in_array(Tokenizer::SEMI_COLON, array_column(iterator_to_array($tokens), 'type'))) return false;
40
+        }
37 41
 
38 42
         return true;
39 43
     }
@@ -43,7 +47,9 @@  discard block
 block discarded – undo
43 47
     }
44 48
 
45 49
     private function tokenize($tss) {
46
-        if (is_file($tss)) $tss = file_get_contents($tss);
50
+        if (is_file($tss)) {
51
+        	$tss = file_get_contents($tss);
52
+        }
47 53
         return (new Parser\Tokenizer($tss))->getTokens();
48 54
     }
49 55
 }
Please login to merge, or discard this patch.
src/Property/ContentPseudo/BeforeAfter.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -4,6 +4,9 @@
 block discarded – undo
4 4
 	private $insertLocation;
5 5
 	private $content;
6 6
 
7
+	/**
8
+	 * @param string $insertLocation
9
+	 */
7 10
 	public function __construct($insertLocation, \Transphporm\Property\Content $content) {
8 11
 		$this->insertLocation = $insertLocation;
9 12
 		$this->content = $content;
Please login to merge, or discard this patch.