@@ -13,7 +13,10 @@ |
||
13 | 13 | |
14 | 14 | public function currency($num) { |
15 | 15 | $num = $this->decimal($num, $this->locale['currency_decimals']); |
16 | - if ($this->locale['currency_position'] === 'before') return $this->locale['currency'] . $num; |
|
17 | - else return $num . $this->locale['currency']; |
|
16 | + if ($this->locale['currency_position'] === 'before') { |
|
17 | + return $this->locale['currency'] . $num; |
|
18 | + } else { |
|
19 | + return $num . $this->locale['currency']; |
|
20 | + } |
|
18 | 21 | } |
19 | 22 | } |
20 | 23 | \ No newline at end of file |
@@ -9,9 +9,13 @@ |
||
9 | 9 | class PostProcess implements \Transphporm\Hook { |
10 | 10 | public function run(\DomElement $element) { |
11 | 11 | $transphporm = $element->getAttribute('transphporm'); |
12 | - if ($transphporm === 'remove') $element->parentNode->removeChild($element); |
|
13 | - else if ($transphporm === 'text') $element->parentNode->replaceChild($element->firstChild, $element); |
|
14 | - else $element->removeAttribute('transphporm'); |
|
12 | + if ($transphporm === 'remove') { |
|
13 | + $element->parentNode->removeChild($element); |
|
14 | + } else if ($transphporm === 'text') { |
|
15 | + $element->parentNode->replaceChild($element->firstChild, $element); |
|
16 | + } else { |
|
17 | + $element->removeAttribute('transphporm'); |
|
18 | + } |
|
15 | 19 | } |
16 | 20 | |
17 | 21 | } |
18 | 22 | \ No newline at end of file |
@@ -31,7 +31,9 @@ |
||
31 | 31 | /** Returns the data that has been bound to $element, or, if no data is bound to $element climb the DOM tree to find the data bound to a parent node*/ |
32 | 32 | public function getData(\DomElement $element = null, $type = 'data') { |
33 | 33 | while ($element) { |
34 | - if (isset($this->elementMap[$element]) && isset($this->elementMap[$element][$type])) return $this->elementMap[$element][$type]; |
|
34 | + if (isset($this->elementMap[$element]) && isset($this->elementMap[$element][$type])) { |
|
35 | + return $this->elementMap[$element][$type]; |
|
36 | + } |
|
35 | 37 | $element = $element->parentNode; |
36 | 38 | } |
37 | 39 | return $this->data; |
@@ -7,8 +7,12 @@ |
||
7 | 7 | namespace Transphporm\Property; |
8 | 8 | class Display implements \Transphporm\Property { |
9 | 9 | public function run(array $values, \DomElement $element, array $rules, \Transphporm\Hook\PseudoMatcher $pseudoMatcher, array $properties = []) { |
10 | - if ($pseudoMatcher->hasFunction('attr')) $element->removeAttribute($pseudoMatcher->getFuncArgs('attr')[0]); |
|
11 | - else if (strtolower($values[0]) === 'none') $element->setAttribute('transphporm', 'remove'); |
|
12 | - else $element->setAttribute('transphporm', 'show'); |
|
10 | + if ($pseudoMatcher->hasFunction('attr')) { |
|
11 | + $element->removeAttribute($pseudoMatcher->getFuncArgs('attr')[0]); |
|
12 | + } else if (strtolower($values[0]) === 'none') { |
|
13 | + $element->setAttribute('transphporm', 'remove'); |
|
14 | + } else { |
|
15 | + $element->setAttribute('transphporm', 'show'); |
|
16 | + } |
|
13 | 17 | } |
14 | 18 | } |
@@ -69,7 +69,9 @@ discard block |
||
69 | 69 | $selector->type = $token['type']; |
70 | 70 | $selectors[] = $selector; |
71 | 71 | } |
72 | - if (isset($token['value'])) $selectors[count($selectors)-1]->string = $token['value']; |
|
72 | + if (isset($token['value'])) { |
|
73 | + $selectors[count($selectors)-1]->string = $token['value']; |
|
74 | + } |
|
73 | 75 | } |
74 | 76 | return $selectors; |
75 | 77 | } |
@@ -79,7 +81,9 @@ discard block |
||
79 | 81 | $selectors = $this->split($css); |
80 | 82 | $xpath = '/'; |
81 | 83 | foreach ($selectors as $selector) { |
82 | - if (isset($this->translators[$selector->type])) $xpath .= $this->translators[$selector->type]($selector->string, $xpath); |
|
84 | + if (isset($this->translators[$selector->type])) { |
|
85 | + $xpath .= $this->translators[$selector->type]($selector->string, $xpath); |
|
86 | + } |
|
83 | 87 | } |
84 | 88 | |
85 | 89 | $xpath = str_replace('/[', '/*[', $xpath); |
@@ -90,7 +94,9 @@ discard block |
||
90 | 94 | private function removeSpacesFromDirectDecend($css) { |
91 | 95 | $tokens = []; |
92 | 96 | foreach ($css->splitOnToken(Tokenizer::GREATER_THAN) as $token) { |
93 | - foreach ($token->trim() as $t) $tokens[] = $t; |
|
97 | + foreach ($token->trim() as $t) { |
|
98 | + $tokens[] = $t; |
|
99 | + } |
|
94 | 100 | $tokens[] = ['type' => Tokenizer::GREATER_THAN]; |
95 | 101 | } |
96 | 102 | return new Tokens(array_slice($tokens, 0, -1)); |
@@ -35,7 +35,9 @@ |
||
35 | 35 | |
36 | 36 | public function rewind() { |
37 | 37 | $this->tokens->rewind(); |
38 | - while ($this->shouldContinue()) $this->tokens->next(); |
|
38 | + while ($this->shouldContinue()) { |
|
39 | + $this->tokens->next(); |
|
40 | + } |
|
39 | 41 | } |
40 | 42 | |
41 | 43 | private function shouldContinue() { |
@@ -18,7 +18,9 @@ discard block |
||
18 | 18 | $rules = $this->cache->load($key, filemtime($file)); |
19 | 19 | if ($rules) { |
20 | 20 | foreach ($rules['import'] as $file) { |
21 | - if (!$this->cache->load($this->getCacheKey($file), filemtime($file))) return false; |
|
21 | + if (!$this->cache->load($this->getCacheKey($file), filemtime($file))) { |
|
22 | + return false; |
|
23 | + } |
|
22 | 24 | } |
23 | 25 | } |
24 | 26 | return $rules; |
@@ -33,7 +35,9 @@ discard block |
||
33 | 35 | } |
34 | 36 | |
35 | 37 | public function write($file, $rules, $imports = []) { |
36 | - if (is_file($file)) $this->cache->write($this->getCacheKey($file), ['rules' => $rules, 'import' => $imports]); |
|
38 | + if (is_file($file)) { |
|
39 | + $this->cache->write($this->getCacheKey($file), ['rules' => $rules, 'import' => $imports]); |
|
40 | + } |
|
37 | 41 | return $rules; |
38 | 42 | } |
39 | 43 | } |
@@ -31,10 +31,11 @@ |
||
31 | 31 | ]; |
32 | 32 | |
33 | 33 | if ($funcs[$this->mode] === 'concat' && is_numeric($newValue) |
34 | - && is_numeric($this->result[count($this->result)-1])) |
|
35 | - $this->add($newValue); |
|
36 | - else |
|
37 | - $this->{$funcs[$this->mode]}($newValue); |
|
34 | + && is_numeric($this->result[count($this->result)-1])) { |
|
35 | + $this->add($newValue); |
|
36 | + } else { |
|
37 | + $this->{$funcs[$this->mode]}($newValue); |
|
38 | + } |
|
38 | 39 | } |
39 | 40 | |
40 | 41 | public function arg($value) { |
@@ -44,23 +44,32 @@ |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | private function timeFrequency($frequency, $time = null) { |
47 | - if ($time === null) $time = time(); |
|
47 | + if ($time === null) { |
|
48 | + $time = time(); |
|
49 | + } |
|
48 | 50 | $num = (int) $frequency; |
49 | 51 | $unit = strtoupper(trim(str_replace($num, '', $frequency))); |
50 | 52 | |
51 | 53 | $offset = $num * constant(self::class . '::' . $unit); |
52 | 54 | |
53 | - if ($time > $this->lastRun + $offset) return true; |
|
54 | - else return false; |
|
55 | + if ($time > $this->lastRun + $offset) { |
|
56 | + return true; |
|
57 | + } else { |
|
58 | + return false; |
|
59 | + } |
|
55 | 60 | } |
56 | 61 | |
57 | 62 | public function shouldRun($time = null) { |
58 | 63 | if (isset($this->properties['update-frequency']) && $this->lastRun !== 0) { |
59 | 64 | $frequency = $this->properties['update-frequency']->read(); |
60 | 65 | $static = ['always' => true, 'never' => false]; |
61 | - if (isset($static[$frequency])) return $static[$frequency]; |
|
62 | - else return $this->timeFrequency($frequency, $time); |
|
66 | + if (isset($static[$frequency])) { |
|
67 | + return $static[$frequency]; |
|
68 | + } else { |
|
69 | + return $this->timeFrequency($frequency, $time); |
|
70 | + } |
|
71 | + } else { |
|
72 | + return true; |
|
63 | 73 | } |
64 | - else return true; |
|
65 | 74 | } |
66 | 75 | } |