Completed
Push — master ( 22285a...59146c )
by Tom
02:25
created
src/Property/Content.php 1 patch
Braces   +18 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,21 +18,28 @@  discard block
 block discarded – undo
18 18
 	}
19 19
 
20 20
 	public function run(array $values, \DomElement $element, array $rules, \Transphporm\Hook\PseudoMatcher $pseudoMatcher, array $properties = []) {
21
-		if (!$this->shouldRun($element)) return false;
21
+		if (!$this->shouldRun($element)) {
22
+			return false;
23
+		}
22 24
 			
23 25
 		$value = $this->formatter->format($values[0], $rules);
24 26
 		if (!$this->processPseudo($value, $element, $pseudoMatcher)) {
25 27
 			//Remove the current contents
26 28
 			$this->removeAllChildren($element);
27 29
 			//Now make a text node
28
-			if ($this->getContentMode($rules) === 'replace') $this->replaceContent($element, $value);
29
-			else $this->appendContent($element, $value);
30
+			if ($this->getContentMode($rules) === 'replace') {
31
+				$this->replaceContent($element, $value);
32
+			} else {
33
+				$this->appendContent($element, $value);
34
+			}
30 35
 		}
31 36
 	}
32 37
 
33 38
 	private function shouldRun($element) {
34 39
 		do {
35
-			if ($element->getAttribute('transphporm') == 'includedtemplate') return false;
40
+			if ($element->getAttribute('transphporm') == 'includedtemplate') {
41
+				return false;
42
+			}
36 43
 		}
37 44
 		while (($element = $element->parentNode) instanceof \DomElement);
38 45
 		return true;
@@ -59,9 +66,10 @@  discard block
 block discarded – undo
59 66
 				$new = $document->importNode($n, true);
60 67
 				//Removing this might cause problems with caching... 
61 68
 				//$new->setAttribute('transphporm', 'added');
62
-			}
63
-			else {
64
-				if ($n instanceof \DomText) $n = $n->nodeValue;
69
+			} else {
70
+				if ($n instanceof \DomText) {
71
+					$n = $n->nodeValue;
72
+				}
65 73
 				$new = $document->createElement('text');
66 74
 				$new->appendChild($document->createTextNode($n));
67 75
 				$new->setAttribute('transphporm', 'text');
@@ -107,6 +115,8 @@  discard block
 block discarded – undo
107 115
 	}
108 116
 	
109 117
 	private function removeAllChildren($element) {
110
-		while ($element->hasChildNodes()) $element->removeChild($element->firstChild);
118
+		while ($element->hasChildNodes()) {
119
+			$element->removeChild($element->firstChild);
120
+		}
111 121
 	}
112 122
 }
113 123
\ No newline at end of file
Please login to merge, or discard this patch.
src/Parser/Sheet.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 			}
29 29
 
30 30
 			$selector = trim(substr($this->tss, $pos, $next-$pos));
31
-			$pos =  strpos($this->tss, '}', $next)+1;
31
+			$pos = strpos($this->tss, '}', $next)+1;
32 32
 			$newRules = $this->cssToRules($selector, count($rules)+$indexStart, $this->getProperties(trim(substr($this->tss, $next+1, $pos-2-$next))));
33 33
 			$rules = $this->writeRule($rules, $newRules);
34 34
 		}
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	private function processingInstructions($tss, $pos, $next, $indexStart) {
64 64
 		$rules = [];
65 65
 		while (($atPos = strpos($tss, '@', $pos)) !== false) {
66
-			if ($atPos  <= (int) $next) {
66
+			if ($atPos <= (int) $next) {
67 67
 				$spacePos = strpos($tss, ' ', $atPos);
68 68
 				$funcName = substr($tss, $atPos+1, $spacePos-$atPos-1);
69 69
 				$pos = strpos($tss, ';', $spacePos);
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
 	private function import($args, $indexStart) {
82 82
 		$fileName = $this->valueParser->parse(trim($args, '\'" '));
83
-		$sheet = new Sheet(file_get_contents($this->baseDir . $fileName[0]), $this->baseDir, $this->valueParser, $this->prefix);
83
+		$sheet = new Sheet(file_get_contents($this->baseDir.$fileName[0]), $this->baseDir, $this->valueParser, $this->prefix);
84 84
 		return $sheet->parse(0, [], $indexStart);
85 85
 	}
86 86
 
Please login to merge, or discard this patch.