Completed
Push — master ( 71ae65...4e11a6 )
by Tom
02:20
created
src/Hook/Formatter.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -34,6 +34,10 @@
 block discarded – undo
34 34
 	}
35 35
 
36 36
 	//TODO: Abstract all error reporting externally with a method for turning it on/off
37
+
38
+	/**
39
+	 * @param boolean $condition
40
+	 */
37 41
 	private function assert($condition, $error) {
38 42
 		if (!$functionExists) throw new \Exception($error);
39 43
 	}
Please login to merge, or discard this patch.
Braces   +7 added lines, -4 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 format($value, $rules) {
17
-		if (!isset($rules['format'])) return $value;
17
+		if (!isset($rules['format'])) {
18
+			return $value;
19
+		}
18 20
 		$tokens = $rules['format'];
19 21
 
20 22
 		$functionName = $tokens->from(\Transphporm\Parser\Tokenizer::NAME, true)->read();
@@ -27,15 +29,16 @@  discard block
 block discarded – undo
27 29
 
28 30
 		try {
29 31
 			return $this->processFormat($options, $functionName, $value);
30
-		}
31
-		catch (\Exception $e) {
32
+		} catch (\Exception $e) {
32 33
 			throw new \Transphporm\RunException(\Transphporm\Exception::FORMATTER, $functionName, $e);
33 34
 		}
34 35
 	}
35 36
 
36 37
 	//TODO: Abstract all error reporting externally with a method for turning it on/off
37 38
 	private function assert($condition, $error) {
38
-		if (!$functionExists) throw new \Exception($error);
39
+		if (!$functionExists) {
40
+			throw new \Exception($error);
41
+		}
39 42
 	}
40 43
 
41 44
 	private function processFormat($format, $functionName, $value) {
Please login to merge, or discard this patch.
src/Hook/PropertyHook.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 		$this->valueParser = $valueParser;
27 27
 		$this->pseudoMatcher = $pseudoMatcher;
28 28
 		$this->functionSet = $functionSet;
29
-		if ($this->file !== null) $this->baseDir = dirname(realpath($this->file)) . DIRECTORY_SEPARATOR;
29
+		if ($this->file !== null) $this->baseDir = dirname(realpath($this->file)).DIRECTORY_SEPARATOR;
30 30
 	}
31 31
 
32 32
 	public function run(\DomElement $element) {
Please login to merge, or discard this patch.
Braces   +14 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@  discard block
 block discarded – undo
26 26
 		$this->valueParser = $valueParser;
27 27
 		$this->pseudoMatcher = $pseudoMatcher;
28 28
 		$this->functionSet = $functionSet;
29
-		if ($this->file !== null) $this->baseDir = dirname(realpath($this->file)) . DIRECTORY_SEPARATOR;
29
+		if ($this->file !== null) {
30
+			$this->baseDir = dirname(realpath($this->file)) . DIRECTORY_SEPARATOR;
31
+		}
30 32
 	}
31 33
 
32 34
 	public function run(\DomElement $element) {
@@ -34,10 +36,11 @@  discard block
 block discarded – undo
34 36
 		$this->configLine = $this->line;
35 37
 		try {
36 38
 			//Don't run if there's a pseudo element like nth-child() and this element doesn't match it
37
-			if (!$this->pseudoMatcher->matches($element)) return;
39
+			if (!$this->pseudoMatcher->matches($element)) {
40
+				return;
41
+			}
38 42
 			$this->callProperties($element);
39
-		}
40
-		catch (\Transphporm\RunException $e) {
43
+		} catch (\Transphporm\RunException $e) {
41 44
 			throw new \Transphporm\Exception($e, $this->file, $this->line);
42 45
 		}
43 46
 	}
@@ -48,7 +51,9 @@  discard block
 block discarded – undo
48 51
 	private function callProperties($element) {
49 52
 		foreach ($this->rules as $name => $value) {
50 53
 			$result = $this->callProperty($name, $element, $this->getArgs($value));
51
-			if ($result === false) break;
54
+			if ($result === false) {
55
+				break;
56
+			}
52 57
 		}
53 58
 	}
54 59
 	private function getArgs($value) {
@@ -63,9 +68,10 @@  discard block
 block discarded – undo
63 68
 		if (isset($this->properties[$name])) {
64 69
 			try {
65 70
 				return $this->properties[$name]->run($value, $element, $this->rules, $this->pseudoMatcher, $this->properties);
66
-			}
67
-			catch (\Exception $e) {
68
-				if ($e instanceof \Transphporm\RunException) throw $e;
71
+			} catch (\Exception $e) {
72
+				if ($e instanceof \Transphporm\RunException) {
73
+					throw $e;
74
+				}
69 75
 				throw new \Transphporm\RunException(\Transphporm\Exception::PROPERTY, $name, $e);
70 76
 			}
71 77
 		}
Please login to merge, or discard this patch.
src/FunctionSet.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,8 +20,7 @@  discard block
 block discarded – undo
20 20
 			if (isset($this->functions[$name])) {
21 21
 				return $this->functions[$name]->run($this->getArgs0($name, $args), $this->element);
22 22
 			}
23
-		}
24
-		catch (\Exception $e) {
23
+		} catch (\Exception $e) {
25 24
 			throw new RunException(Exception::TSS_FUNCTION, $name, $e);
26 25
 		}
27 26
 		return true;
@@ -32,8 +31,7 @@  discard block
 block discarded – undo
32 31
 			$tokens = $args[0];
33 32
 			$parser = new \Transphporm\Parser\Value($this);
34 33
 			return $parser->parseTokens($tokens, $this->elementData->getData($this->element));
35
-		}
36
-		else if ($args[0] instanceof Parser\Tokens) {
34
+		} else if ($args[0] instanceof Parser\Tokens) {
37 35
 			return iterator_to_array($args[0]);
38 36
 		}
39 37
 
Please login to merge, or discard this patch.