Completed
Push — master ( 5d19ef...aa44e7 )
by Tom
02:20
created
src/Parser/CssToXpath.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -49,11 +49,11 @@
 block discarded – undo
49 49
 		$functionSet->setElement($element[0]);
50 50
 
51 51
 		$attributes = array();
52
-        foreach($element[0]->attributes as $attribute_name => $attribute_node) {
53
-            $attributes[$attribute_name] = $attribute_node->nodeValue;
54
-        }
52
+		foreach($element[0]->attributes as $attribute_name => $attribute_node) {
53
+			$attributes[$attribute_name] = $attribute_node->nodeValue;
54
+		}
55 55
 
56
-        $parser = new \Transphporm\Parser\Value($functionSet, true);
56
+		$parser = new \Transphporm\Parser\Value($functionSet, true);
57 57
 		$return = $parser->parseTokens($attr, $attributes);
58 58
 
59 59
 		return $return[0] === '' ? false : $return[0];
Please login to merge, or discard this patch.
src/Parser/Sheet.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -102,14 +102,14 @@
 block discarded – undo
102 102
 	}
103 103
 
104 104
 	private function getProperties($tokens) {
105
-        $rules = $tokens->splitOnToken(Tokenizer::SEMI_COLON);
105
+		$rules = $tokens->splitOnToken(Tokenizer::SEMI_COLON);
106 106
 
107
-        $return = [];
108
-        foreach ($rules as $rule) {
109
-            $name = $rule->from(Tokenizer::NAME, true)->to(Tokenizer::COLON)->read();
110
-            $return[$name] = $rule->from(Tokenizer::COLON)->trim();
111
-        }
107
+		$return = [];
108
+		foreach ($rules as $rule) {
109
+			$name = $rule->from(Tokenizer::NAME, true)->to(Tokenizer::COLON)->read();
110
+			$return[$name] = $rule->from(Tokenizer::COLON)->trim();
111
+		}
112 112
 
113
-        return $return;
114
-    }
113
+		return $return;
114
+	}
115 115
 }
Please login to merge, or discard this patch.
src/Parser/TokenFilterIterator.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -6,39 +6,39 @@
 block discarded – undo
6 6
  * @version         1.0                                                             */
7 7
 namespace Transphporm\Parser;
8 8
 class TokenFilterIterator implements \Iterator {
9
-    private $ignore;
10
-    private $tokens;
9
+	private $ignore;
10
+	private $tokens;
11 11
 
12
-    public function __construct(Tokens $tokens, array $ignore) {
13
-        $this->ignore = $ignore;
14
-        $this->tokens = $tokens;
15
-    }
12
+	public function __construct(Tokens $tokens, array $ignore) {
13
+		$this->ignore = $ignore;
14
+		$this->tokens = $tokens;
15
+	}
16 16
 
17
-    public function current() {
18
-        return $this->tokens->current();
19
-    }
17
+	public function current() {
18
+		return $this->tokens->current();
19
+	}
20 20
 
21
-    public function key() {
22
-        return $this->tokens->key();
23
-    }
21
+	public function key() {
22
+		return $this->tokens->key();
23
+	}
24 24
 
25
-    public function valid() {
26
-        return $this->tokens->valid();
27
-    }
25
+	public function valid() {
26
+		return $this->tokens->valid();
27
+	}
28 28
 
29
-    public function next() {
30
-        do {
31
-            $this->tokens->next();
32
-        }
33
-        while ($this->shouldContinue());
34
-    }
29
+	public function next() {
30
+		do {
31
+			$this->tokens->next();
32
+		}
33
+		while ($this->shouldContinue());
34
+	}
35 35
 
36
-    public function rewind() {
37
-        $this->tokens->rewind();
38
-        while ($this->shouldContinue()) $this->tokens->next();
39
-    }
36
+	public function rewind() {
37
+		$this->tokens->rewind();
38
+		while ($this->shouldContinue()) $this->tokens->next();
39
+	}
40 40
 
41
-    private function shouldContinue() {
42
-        return $this->tokens->valid() && in_array($this->tokens->current()['type'], $this->ignore);
43
-    }
41
+	private function shouldContinue() {
42
+		return $this->tokens->valid() && in_array($this->tokens->current()['type'], $this->ignore);
43
+	}
44 44
 }
Please login to merge, or discard this patch.
src/RunException.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Transphporm;
3 3
 class RunException extends \Exception {
4
-    public function __construct($operationType, $operationName, \Exception $previous) {
5
-        $message = 'TSS Error: Problem carrying out ' . $operationType . ' \'' . $operationName . '\'';
4
+	public function __construct($operationType, $operationName, \Exception $previous) {
5
+		$message = 'TSS Error: Problem carrying out ' . $operationType . ' \'' . $operationName . '\'';
6 6
 
7
-        parent::__construct($message, 0, $previous);
8
-    }
7
+		parent::__construct($message, 0, $previous);
8
+	}
9 9
 }
Please login to merge, or discard this patch.
src/Exception.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Transphporm;
3 3
 class Exception extends \Exception {
4
-    const PROPERTY = 'property';
5
-    const TSS_FUNCTION = 'function';
6
-    const PSEUDO = 'pseudo';
7
-    const FORMATTER = 'formatter';
4
+	const PROPERTY = 'property';
5
+	const TSS_FUNCTION = 'function';
6
+	const PSEUDO = 'pseudo';
7
+	const FORMATTER = 'formatter';
8 8
 
9
-    public function __construct(RunException $runException, $file, $line) {
10
-        $message = $runException->getMessage() . ' on Line ' . $line . ' of ' . ($file === null ? 'tss' : $file);
9
+	public function __construct(RunException $runException, $file, $line) {
10
+		$message = $runException->getMessage() . ' on Line ' . $line . ' of ' . ($file === null ? 'tss' : $file);
11 11
 
12
-        parent::__construct($message, 0, $runException->getPrevious());
13
-    }
12
+		parent::__construct($message, 0, $runException->getPrevious());
13
+	}
14 14
 }
Please login to merge, or discard this patch.
src/TSSCache.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace Transphporm;
3 3
 class TSSCache {
4
-    private $cache;
5
-    private $prefix;
4
+	private $cache;
5
+	private $prefix;
6 6
 
7
-    public function __construct(Cache $cache, $prefix) {
8
-        $this->cache = $cache;
9
-        $this->prefix = $prefix;
10
-    }
7
+	public function __construct(Cache $cache, $prefix) {
8
+		$this->cache = $cache;
9
+		$this->prefix = $prefix;
10
+	}
11 11
 
12 12
 	private function getRulesFromCache($file) {
13 13
 		//The cache for the key: the filename and template prefix
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
 		return $file . $this->prefix . dirname(realpath($file)) . DIRECTORY_SEPARATOR;
29 29
 	}
30 30
 
31
-    public function load($tss) {
32
-        return $this->getRulesFromCache($tss);
33
-    }
31
+	public function load($tss) {
32
+		return $this->getRulesFromCache($tss);
33
+	}
34 34
 
35
-    public function write($file, $rules, $imports = []) {
36
-        if (is_file($file)) $this->cache->write($this->getCacheKey($file), ['rules' => $rules, 'import' => $imports]);
37
-        return $rules;
38
-    }
35
+	public function write($file, $rules, $imports = []) {
36
+		if (is_file($file)) $this->cache->write($this->getCacheKey($file), ['rules' => $rules, 'import' => $imports]);
37
+		return $rules;
38
+	}
39 39
 }
Please login to merge, or discard this patch.
src/TSSFunction/Json.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,29 +1,29 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Transphporm\TSSFunction;
3 3
 class Json implements \Transphporm\TSSFunction {
4
-    private $filePath;
4
+	private $filePath;
5 5
 
6
-    public function __construct(\Transphporm\FilePath $filePath) {
7
-        $this->filePath = $filePath;
8
-    }
6
+	public function __construct(\Transphporm\FilePath $filePath) {
7
+		$this->filePath = $filePath;
8
+	}
9 9
 
10
-    public function run(array $args, \DomElement $element = null) {
11
-        $json = $args[0];
10
+	public function run(array $args, \DomElement $element = null) {
11
+		$json = $args[0];
12 12
 
13
-        if ($this->isJsonFile($json)) {
14
-            $path = $this->filePath->getFilePath($json);
15
-            if (!file_exists($path)) throw new \Exception('File does not exist at: ' . $path);
16
-            $json = file_get_contents($path);
17
-        }
13
+		if ($this->isJsonFile($json)) {
14
+			$path = $this->filePath->getFilePath($json);
15
+			if (!file_exists($path)) throw new \Exception('File does not exist at: ' . $path);
16
+			$json = file_get_contents($path);
17
+		}
18 18
 
19
-        $map = json_decode($json, true);
19
+		$map = json_decode($json, true);
20 20
 
21
-        if (!is_array($map)) throw new \Exception('Could not decode json: ' . json_last_error_msg());
21
+		if (!is_array($map)) throw new \Exception('Could not decode json: ' . json_last_error_msg());
22 22
 
23
-        return $map;
24
-    }
23
+		return $map;
24
+	}
25 25
 
26
-    private function isJsonFile($json) {
27
-        return trim($json)[0] != '{' && trim($json)[0] != '[';
28
-    }
26
+	private function isJsonFile($json) {
27
+		return trim($json)[0] != '{' && trim($json)[0] != '[';
28
+	}
29 29
 }
Please login to merge, or discard this patch.
src/Parser/Tokens.php 1 patch
Indentation   +74 added lines, -74 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,67 +38,67 @@  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
-    }
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
-    }
52
-
53
-    public function from($tokenType, $inclusive = false) {
54
-        $key = $this->getKeyToSlice($tokenType);
55
-        if ($key === false) return new Tokens([]);
56
-        if (!$inclusive) $key++;
57
-        return new Tokens(array_slice($this->tokens, $key));
58
-    }
59
-
60
-    public function to($tokenType, $inclusive = false) {
61
-        $key = $this->getKeyToSlice($tokenType);
62
-        if ($key === false) return new Tokens([]);
63
-        if ($inclusive) $key++;
64
-        return new Tokens(array_slice($this->tokens, $this->iterator, $key));
65
-    }
66
-
67
-    public function skip($count) {
68
-        $this->iterator += $count;
69
-    }
70
-
71
-    public function splitOnToken($tokenType) {
72
-        $splitTokens = [];
41
+	private function getKeysOfTokenType($tokenType) {
42
+		return array_keys(array_column($this->tokens, 'type'), $tokenType);
43
+	}
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
+	}
52
+
53
+	public function from($tokenType, $inclusive = false) {
54
+		$key = $this->getKeyToSlice($tokenType);
55
+		if ($key === false) return new Tokens([]);
56
+		if (!$inclusive) $key++;
57
+		return new Tokens(array_slice($this->tokens, $key));
58
+	}
59
+
60
+	public function to($tokenType, $inclusive = false) {
61
+		$key = $this->getKeyToSlice($tokenType);
62
+		if ($key === false) return new Tokens([]);
63
+		if ($inclusive) $key++;
64
+		return new Tokens(array_slice($this->tokens, $this->iterator, $key));
65
+	}
66
+
67
+	public function skip($count) {
68
+		$this->iterator += $count;
69
+	}
70
+
71
+	public function splitOnToken($tokenType) {
72
+		$splitTokens = [];
73 73
 		$i = 0;
74 74
 		foreach ($this->tokens as $token) {
75 75
 			if ($token['type'] === $tokenType) $i++;
76 76
 			else $splitTokens[$i][] = $token;
77 77
 		}
78
-        return array_map(function ($tokens) {
79
-            return new Tokens($tokens);
80
-        }, $splitTokens);
78
+		return array_map(function ($tokens) {
79
+			return new Tokens($tokens);
80
+		}, $splitTokens);
81 81
 		//return $splitTokens;
82
-    }
83
-
84
-    public function trim() {
85
-        $tokens = $this->tokens;
86
-        // Remove end whitespace
87
-        while (end($tokens)['type'] === Tokenizer::WHITESPACE) {
88
-            array_pop($tokens);
89
-        }
90
-        // Remove begining whitespace
91
-        while (isset($tokens[0]) && $tokens[0]['type'] === Tokenizer::WHITESPACE) {
92
-            array_shift($tokens);
93
-        }
94
-        return new Tokens($tokens);
95
-    }
96
-
97
-    public function read($offset = 0) {
98
-        return isset($this->tokens[$offset]) ? $this->tokens[$offset]['value'] : false;
99
-    }
100
-
101
-    public function type($offset = 0) {
102
-        return isset($this->tokens[$offset]) ? $this->tokens[$offset]['type'] : false;
103
-    }
82
+	}
83
+
84
+	public function trim() {
85
+		$tokens = $this->tokens;
86
+		// Remove end whitespace
87
+		while (end($tokens)['type'] === Tokenizer::WHITESPACE) {
88
+			array_pop($tokens);
89
+		}
90
+		// Remove begining whitespace
91
+		while (isset($tokens[0]) && $tokens[0]['type'] === Tokenizer::WHITESPACE) {
92
+			array_shift($tokens);
93
+		}
94
+		return new Tokens($tokens);
95
+	}
96
+
97
+	public function read($offset = 0) {
98
+		return isset($this->tokens[$offset]) ? $this->tokens[$offset]['value'] : false;
99
+	}
100
+
101
+	public function type($offset = 0) {
102
+		return isset($this->tokens[$offset]) ? $this->tokens[$offset]['type'] : false;
103
+	}
104 104
 }
Please login to merge, or discard this patch.
src/Formatter/HTMLFormatter.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Transphporm\Formatter;
3 3
 class HTMLFormatter {
4
-    private $templateFunction;
4
+	private $templateFunction;
5 5
 
6
-    public function __construct(\Transphporm\TSSFunction\Template $templateFunction) {
7
-        $this->templateFunction = $templateFunction;
8
-    }
6
+	public function __construct(\Transphporm\TSSFunction\Template $templateFunction) {
7
+		$this->templateFunction = $templateFunction;
8
+	}
9 9
 
10
-    public function html($val) {
10
+	public function html($val) {
11 11
 		return $this->templateFunction->run(['<template>' . $val . '</template>']);
12 12
 	}
13 13
 
Please login to merge, or discard this patch.