Completed
Pull Request — master (#47)
by
unknown
03:23
created
src/FeatureSet.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,12 +35,16 @@
 block discarded – undo
35 35
 	}
36 36
 
37 37
 	public function loadProperties(Hook\PropertyHook $hook) {
38
-		foreach ($this->properties as $name => $property) $hook->registerProperty($name, $property);
38
+		foreach ($this->properties as $name => $property) {
39
+			$hook->registerProperty($name, $property);
40
+		}
39 41
 	}
40 42
 
41 43
 	public function createPseudoMatcher($pseudo) {
42 44
 		$pseudoMatcher = new Hook\PseudoMatcher($pseudo);
43
-		foreach ($this->pseudo as $pseudoFunction) $pseudoMatcher->registerFunction($pseudoFunction);
45
+		foreach ($this->pseudo as $pseudoFunction) {
46
+			$pseudoMatcher->registerFunction($pseudoFunction);
47
+		}
44 48
 		return $pseudoMatcher;
45 49
 	}
46 50
 }
47 51
\ No newline at end of file
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
@@ -14,8 +14,8 @@
 block discarded – undo
14 14
 
15 15
 	private function getLocale() {
16 16
 		if (is_array($this->locale)) return $this->locale;
17
-		else if (strlen($this->locale) > 0) return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '../' . $this->locale . '.json'), true);
18
-		else return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '../Formatter' . DIRECTORY_SEPARATOR . 'Locale' . DIRECTORY_SEPARATOR . 'enGB.json'), true);
17
+		else if (strlen($this->locale) > 0) return json_decode(file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'../'.$this->locale.'.json'), true);
18
+		else return json_decode(file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'../Formatter'.DIRECTORY_SEPARATOR.'Locale'.DIRECTORY_SEPARATOR.'enGB.json'), true);
19 19
 	}
20 20
 
21 21
 	public function load(\Transphporm\FeatureSet $featureSet) {
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,9 +13,13 @@
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	private function getLocale() {
16
-		if (is_array($this->locale)) return $this->locale;
17
-		else if (strlen($this->locale) > 0) return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '../' . $this->locale . '.json'), true);
18
-		else return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '../Formatter' . DIRECTORY_SEPARATOR . 'Locale' . DIRECTORY_SEPARATOR . 'enGB.json'), true);
16
+		if (is_array($this->locale)) {
17
+			return $this->locale;
18
+		} else if (strlen($this->locale) > 0) {
19
+			return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '../' . $this->locale . '.json'), true);
20
+		} else {
21
+			return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '../Formatter' . DIRECTORY_SEPARATOR . 'Locale' . DIRECTORY_SEPARATOR . 'enGB.json'), true);
22
+		}
19 23
 	}
20 24
 
21 25
 	public function load(\Transphporm\FeatureSet $featureSet) {
Please login to merge, or discard this patch.
src/Property/Repeat.php 2 patches
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,13 +13,17 @@  discard block
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	public function run($value, \DomElement $element, array $rules, \Transphporm\Hook\PseudoMatcher $pseudoMatcher, array $properties = []) {
16
-		if ($element->getAttribute('transphporm') === 'added') return $element->parentNode->removeChild($element);
16
+		if ($element->getAttribute('transphporm') === 'added') {
17
+			return $element->parentNode->removeChild($element);
18
+		}
17 19
 
18 20
 		$count = 0;
19 21
 		foreach ($value as $key => $iteration) {
20 22
 			$clone = $element->cloneNode(true);
21 23
 			//Mark all but one of the nodes as having been added by transphporm, when the hook is run again, these are removed
22
-			if ($count++ > 0) $clone->setAttribute('transphporm', 'added');
24
+			if ($count++ > 0) {
25
+				$clone->setAttribute('transphporm', 'added');
26
+			}
23 27
 			$this->data->bind($clone, $iteration, 'iteration');
24 28
 			$this->data->bind($clone, $key, 'key');
25 29
 			$element->parentNode->insertBefore($clone, $element);
@@ -36,7 +40,9 @@  discard block
 block discarded – undo
36 40
 
37 41
 	private function createHook($newRules, $pseudoMatcher, $properties) {
38 42
 		$hook = new \Transphporm\Hook\PropertyHook($newRules, $pseudoMatcher, new \Transphporm\Parser\Value($this->data));
39
-		foreach ($properties as $name => $property) $hook->registerProperty($name, $property);
43
+		foreach ($properties as $name => $property) {
44
+			$hook->registerProperty($name, $property);
45
+		}
40 46
 		return $hook;
41 47
 	}
42 48
 }
43 49
\ No newline at end of file
Please login to merge, or discard this patch.
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -8,6 +8,9 @@  discard block
 block discarded – undo
8 8
 class Repeat implements \Transphporm\Property {
9 9
 	private $data;
10 10
 
11
+	/**
12
+	 * @param \Transphporm\Hook\DataFunction $data
13
+	 */
11 14
 	public function __construct($data) {
12 15
 		$this->data = $data;
13 16
 	}
@@ -34,6 +37,9 @@  discard block
 block discarded – undo
34 37
 		return false;
35 38
 	}
36 39
 
40
+	/**
41
+	 * @param \Transphporm\Hook\PseudoMatcher $pseudoMatcher
42
+	 */
37 43
 	private function createHook($newRules, $pseudoMatcher, $properties) {
38 44
 		$hook = new \Transphporm\Hook\PropertyHook($newRules, $pseudoMatcher, new \Transphporm\Parser\Value($this->data));
39 45
 		foreach ($properties as $name => $property) $hook->registerProperty($name, $property);
Please login to merge, or discard this patch.
src/Parser/StringExtractor.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@
 block discarded – undo
23 23
 			$end = strpos($str, '"', $pos+1);
24 24
 			if (!$end) break;
25 25
 			while ($str[$end-1] == '\\') $end = strpos($str, '"', $end+1);
26
-			$strings['$___STR' . ++$num] = substr($str, $pos, $end-$pos+1);
27
-			$str = substr_replace($str, '$___STR' . $num, $pos, $end-$pos+1);
26
+			$strings['$___STR'.++$num] = substr($str, $pos, $end-$pos+1);
27
+			$str = substr_replace($str, '$___STR'.$num, $pos, $end-$pos+1);
28 28
 		}
29 29
 
30 30
 		return [$str, $strings];
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,8 +21,12 @@
 block discarded – undo
21 21
 		$strings = [];
22 22
 		while (isset($str[$pos]) && ($pos = strpos($str, '"', $pos)) !== false) {
23 23
 			$end = strpos($str, '"', $pos+1);
24
-			if (!$end) break;
25
-			while ($str[$end-1] == '\\') $end = strpos($str, '"', $end+1);
24
+			if (!$end) {
25
+				break;
26
+			}
27
+			while ($str[$end-1] == '\\') {
28
+				$end = strpos($str, '"', $end+1);
29
+			}
26 30
 			$strings['$___STR' . ++$num] = substr($str, $pos, $end-$pos+1);
27 31
 			$str = substr_replace($str, '$___STR' . $num, $pos, $end-$pos+1);
28 32
 		}
Please login to merge, or discard this patch.