Completed
Push — master ( 6df84f...409692 )
by Richard
02:18
created
src/Config.php 1 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/Tokens.php 2 patches
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -6,28 +6,28 @@  discard block
 block discarded – undo
6 6
  * @version         1.0                                                             */
7 7
 namespace Transphporm\Parser;
8 8
 class Tokens implements \Iterator, \Countable {
9
-    private $tokens;
10
-    private $iterator = 0;
9
+	private $tokens;
10
+	private $iterator = 0;
11 11
 
12
-    public function __construct(array $tokens) {
13
-        $this->tokens = $tokens;
14
-    }
12
+	public function __construct(array $tokens) {
13
+		$this->tokens = $tokens;
14
+	}
15 15
 
16
-    public function count() {
17
-        return count($this->tokens);
18
-    }
16
+	public function count() {
17
+		return count($this->tokens);
18
+	}
19 19
 
20
-    // Iterator Functions
21
-    public function current() {
22
-        return $this->tokens[$this->iterator];
23
-    }
20
+	// Iterator Functions
21
+	public function current() {
22
+		return $this->tokens[$this->iterator];
23
+	}
24 24
 
25
-    public function key() {
26
-        return $this->iterator;
27
-    }
25
+	public function key() {
26
+		return $this->iterator;
27
+	}
28 28
 
29
-    public function next() {
30
-        ++$this->iterator;
29
+	public function next() {
30
+		++$this->iterator;
31 31
 	}
32 32
 
33 33
 	public function valid() {
@@ -38,74 +38,74 @@  discard block
 block discarded – undo
38 38
 		$this->iterator = 0;
39 39
 	}
40 40
 
41
-    private function getKeysOfTokenType($tokenType) {
42
-        return array_keys(array_column($this->tokens, 'type'), $tokenType);
43
-    }
41
+	private function getKeysOfTokenType($tokenType) {
42
+		return array_keys(array_column($this->tokens, 'type'), $tokenType);
43
+	}
44 44
 
45
-    private function getKeyToSlice($tokenType) {
46
-        $keys = $this->getKeysOfTokenType($tokenType);
47
-        if (empty($keys)) return false;
48
-        $key = $keys[0];
49
-        for ($i = 0; $key < $this->iterator && isset($keys[$i]); $i++) $key = $keys[$i];
50
-        return $key;
51
-    }
45
+	private function getKeyToSlice($tokenType) {
46
+		$keys = $this->getKeysOfTokenType($tokenType);
47
+		if (empty($keys)) return false;
48
+		$key = $keys[0];
49
+		for ($i = 0; $key < $this->iterator && isset($keys[$i]); $i++) $key = $keys[$i];
50
+		return $key;
51
+	}
52 52
 
53
-    public function from($tokenType, $inclusive = false) {
54
-        return $this->sliceTokens($tokenType, "from", $inclusive);
55
-    }
53
+	public function from($tokenType, $inclusive = false) {
54
+		return $this->sliceTokens($tokenType, "from", $inclusive);
55
+	}
56 56
 
57
-    public function to($tokenType, $inclusive = false) {
58
-        return $this->sliceTokens($tokenType, "to", $inclusive);
59
-    }
57
+	public function to($tokenType, $inclusive = false) {
58
+		return $this->sliceTokens($tokenType, "to", $inclusive);
59
+	}
60 60
 
61
-    private function sliceTokens($tokenType, $type, $inclusive = false) {
62
-        $key = $this->getKeyToSlice($tokenType);
63
-        if ($key === false) return new Tokens([]);
64
-        if ($type === "from") return new Tokens(array_slice($this->tokens, $inclusive ? $key : $key+1));
65
-        else return new Tokens(array_slice($this->tokens, $this->iterator, $inclusive ? $key+1 : $key));
66
-    }
61
+	private function sliceTokens($tokenType, $type, $inclusive = false) {
62
+		$key = $this->getKeyToSlice($tokenType);
63
+		if ($key === false) return new Tokens([]);
64
+		if ($type === "from") return new Tokens(array_slice($this->tokens, $inclusive ? $key : $key+1));
65
+		else return new Tokens(array_slice($this->tokens, $this->iterator, $inclusive ? $key+1 : $key));
66
+	}
67 67
 
68
-    public function skip($count) {
69
-        $this->iterator += $count;
70
-    }
68
+	public function skip($count) {
69
+		$this->iterator += $count;
70
+	}
71 71
 
72
-    public function splitOnToken($tokenType) {
73
-        $splitTokens = [];
72
+	public function splitOnToken($tokenType) {
73
+		$splitTokens = [];
74 74
 		$i = 0;
75 75
 		foreach ($this->tokens as $token) {
76 76
 			if ($token['type'] === $tokenType) $i++;
77 77
 			else $splitTokens[$i][] = $token;
78 78
 		}
79
-        return array_map(function ($tokens) {
80
-            return new Tokens($tokens);
81
-        }, $splitTokens);
79
+		return array_map(function ($tokens) {
80
+			return new Tokens($tokens);
81
+		}, $splitTokens);
82 82
 		//return $splitTokens;
83
-    }
84
-
85
-    public function trim() {
86
-        $tokens = $this->tokens;
87
-        // Remove end whitespace
88
-        while (end($tokens)['type'] === Tokenizer::WHITESPACE) {
89
-            array_pop($tokens);
90
-        }
91
-        // Remove begining whitespace
92
-        while (isset($tokens[0]) && $tokens[0]['type'] === Tokenizer::WHITESPACE) {
93
-            array_shift($tokens);
94
-        }
95
-        return new Tokens($tokens);
96
-    }
97
-
98
-    public function removeLine() {
99
-        $tokens = $this->tokens;
100
-        foreach ($tokens as &$token) unset($token['line']);
101
-        return new Tokens($tokens);
102
-    }
103
-
104
-    public function read($offset = 0) {
105
-        return isset($this->tokens[$offset]) ? $this->tokens[$offset]['value'] : false;
106
-    }
107
-
108
-    public function type($offset = 0) {
109
-        return isset($this->tokens[$offset]) ? $this->tokens[$offset]['type'] : false;
110
-    }
83
+	}
84
+
85
+	public function trim() {
86
+		$tokens = $this->tokens;
87
+		// Remove end whitespace
88
+		while (end($tokens)['type'] === Tokenizer::WHITESPACE) {
89
+			array_pop($tokens);
90
+		}
91
+		// Remove begining whitespace
92
+		while (isset($tokens[0]) && $tokens[0]['type'] === Tokenizer::WHITESPACE) {
93
+			array_shift($tokens);
94
+		}
95
+		return new Tokens($tokens);
96
+	}
97
+
98
+	public function removeLine() {
99
+		$tokens = $this->tokens;
100
+		foreach ($tokens as &$token) unset($token['line']);
101
+		return new Tokens($tokens);
102
+	}
103
+
104
+	public function read($offset = 0) {
105
+		return isset($this->tokens[$offset]) ? $this->tokens[$offset]['value'] : false;
106
+	}
107
+
108
+	public function type($offset = 0) {
109
+		return isset($this->tokens[$offset]) ? $this->tokens[$offset]['type'] : false;
110
+	}
111 111
 }
Please login to merge, or discard this patch.
Braces   +22 added lines, -8 removed lines patch added patch discarded remove patch
@@ -44,9 +44,13 @@  discard block
 block discarded – undo
44 44
 
45 45
     private function getKeyToSlice($tokenType) {
46 46
         $keys = $this->getKeysOfTokenType($tokenType);
47
-        if (empty($keys)) return false;
47
+        if (empty($keys)) {
48
+        	return false;
49
+        }
48 50
         $key = $keys[0];
49
-        for ($i = 0; $key < $this->iterator && isset($keys[$i]); $i++) $key = $keys[$i];
51
+        for ($i = 0; $key < $this->iterator && isset($keys[$i]); $i++) {
52
+        	$key = $keys[$i];
53
+        }
50 54
         return $key;
51 55
     }
52 56
 
@@ -60,9 +64,14 @@  discard block
 block discarded – undo
60 64
 
61 65
     private function sliceTokens($tokenType, $type, $inclusive = false) {
62 66
         $key = $this->getKeyToSlice($tokenType);
63
-        if ($key === false) return new Tokens([]);
64
-        if ($type === "from") return new Tokens(array_slice($this->tokens, $inclusive ? $key : $key+1));
65
-        else return new Tokens(array_slice($this->tokens, $this->iterator, $inclusive ? $key+1 : $key));
67
+        if ($key === false) {
68
+        	return new Tokens([]);
69
+        }
70
+        if ($type === "from") {
71
+        	return new Tokens(array_slice($this->tokens, $inclusive ? $key : $key+1));
72
+        } else {
73
+        	return new Tokens(array_slice($this->tokens, $this->iterator, $inclusive ? $key+1 : $key));
74
+        }
66 75
     }
67 76
 
68 77
     public function skip($count) {
@@ -73,8 +82,11 @@  discard block
 block discarded – undo
73 82
         $splitTokens = [];
74 83
 		$i = 0;
75 84
 		foreach ($this->tokens as $token) {
76
-			if ($token['type'] === $tokenType) $i++;
77
-			else $splitTokens[$i][] = $token;
85
+			if ($token['type'] === $tokenType) {
86
+				$i++;
87
+			} else {
88
+				$splitTokens[$i][] = $token;
89
+			}
78 90
 		}
79 91
         return array_map(function ($tokens) {
80 92
             return new Tokens($tokens);
@@ -97,7 +109,9 @@  discard block
 block discarded – undo
97 109
 
98 110
     public function removeLine() {
99 111
         $tokens = $this->tokens;
100
-        foreach ($tokens as &$token) unset($token['line']);
112
+        foreach ($tokens as &$token) {
113
+        	unset($token['line']);
114
+        }
101 115
         return new Tokens($tokens);
102 116
     }
103 117
 
Please login to merge, or discard this patch.