@@ -29,17 +29,23 @@ discard block |
||
29 | 29 | $close = strpos($string, $closingChr, $open); |
30 | 30 | |
31 | 31 | $cPos = $open+1; |
32 | - while (($cPos = strpos($string, $openChr, $cPos+1)) !== false && $cPos < $close) $close = strpos($string, $closingChr, $close+1); |
|
32 | + while (($cPos = strpos($string, $openChr, $cPos+1)) !== false && $cPos < $close) { |
|
33 | + $close = strpos($string, $closingChr, $close+1); |
|
34 | + } |
|
33 | 35 | |
34 | 36 | return substr($string, $open+1, $close-$open-1); |
35 | 37 | } |
36 | 38 | |
37 | 39 | private function attribute($pseudo, $element) { |
38 | 40 | $pos = strpos($pseudo, '['); |
39 | - if ($pos === false) return true; |
|
41 | + if ($pos === false) { |
|
42 | + return true; |
|
43 | + } |
|
40 | 44 | |
41 | 45 | $name = substr($pseudo, 0, $pos); |
42 | - if (!is_callable([$this->dataFunction, $name])) return true; |
|
46 | + if (!is_callable([$this->dataFunction, $name])) { |
|
47 | + return true; |
|
48 | + } |
|
43 | 49 | |
44 | 50 | $criteria = $this->betweenBrackets($pseudo, '[', ']'); |
45 | 51 | |
@@ -60,16 +66,21 @@ discard block |
||
60 | 66 | } |
61 | 67 | |
62 | 68 | private function parseValue($value) { |
63 | - if ($value == 'true') return true; |
|
64 | - else if ($value == 'false') return false; |
|
65 | - else return $value; |
|
69 | + if ($value == 'true') { |
|
70 | + return true; |
|
71 | + } else if ($value == 'false') { |
|
72 | + return false; |
|
73 | + } else { |
|
74 | + return $value; |
|
75 | + } |
|
66 | 76 | } |
67 | 77 | |
68 | 78 | private function getOperator($field) { |
69 | 79 | if ($field[strlen($field)-1] == '!') { |
70 | 80 | return '!'; |
81 | + } else { |
|
82 | + return ''; |
|
71 | 83 | } |
72 | - else return ''; |
|
73 | 84 | } |
74 | 85 | |
75 | 86 | private function nth($pseudo, $element) { |
@@ -77,8 +88,11 @@ discard block |
||
77 | 88 | $criteria = $this->getBetween($pseudo, '(', ')'); |
78 | 89 | $num = $this->getBetween($element->getNodePath(), '[', ']'); |
79 | 90 | |
80 | - if (is_callable([$this, $criteria])) return $this->$criteria($num); |
|
81 | - else return $num == $criteria; |
|
91 | + if (is_callable([$this, $criteria])) { |
|
92 | + return $this->$criteria($num); |
|
93 | + } else { |
|
94 | + return $num == $criteria; |
|
95 | + } |
|
82 | 96 | |
83 | 97 | } |
84 | 98 | return true; |
@@ -98,7 +112,9 @@ discard block |
||
98 | 112 | public function header($element) { |
99 | 113 | if ($this->matches($element)) { |
100 | 114 | foreach ($this->pseudo as $pseudo) { |
101 | - if (strpos($pseudo, 'header') === 0) return $this->getBetween($pseudo, '[', ']'); |
|
115 | + if (strpos($pseudo, 'header') === 0) { |
|
116 | + return $this->getBetween($pseudo, '[', ']'); |
|
117 | + } |
|
102 | 118 | } |
103 | 119 | } |
104 | 120 | } |
@@ -113,7 +129,9 @@ discard block |
||
113 | 129 | |
114 | 130 | private function getBetween($string, $start, $end) { |
115 | 131 | $open = strpos($string, $start); |
116 | - if ($open === false) return false; |
|
132 | + if ($open === false) { |
|
133 | + return false; |
|
134 | + } |
|
117 | 135 | $close = strpos($string, $end, $open); |
118 | 136 | return substr($string, $open+1, $close-$open-1); |
119 | 137 | } |