@@ -14,10 +14,14 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | public function match($pseudo, \DomElement $element) { |
| 16 | 16 | $pos = strpos($pseudo, '['); |
| 17 | - if ($pos === false) return true; |
|
| 17 | + if ($pos === false) { |
|
| 18 | + return true; |
|
| 19 | + } |
|
| 18 | 20 | |
| 19 | 21 | $name = substr($pseudo, 0, $pos); |
| 20 | - if (!is_callable([$this->dataFunction, $name])) return true; |
|
| 22 | + if (!is_callable([$this->dataFunction, $name])) { |
|
| 23 | + return true; |
|
| 24 | + } |
|
| 21 | 25 | |
| 22 | 26 | $bracketMatcher = new \Transphporm\Parser\BracketMatcher($pseudo); |
| 23 | 27 | $criteria = $bracketMatcher->match('[', ']'); |
@@ -42,16 +46,21 @@ discard block |
||
| 42 | 46 | } |
| 43 | 47 | |
| 44 | 48 | private function parseValue($value) { |
| 45 | - if ($value == 'true') return true; |
|
| 46 | - else if ($value == 'false') return false; |
|
| 47 | - else return $value; |
|
| 49 | + if ($value == 'true') { |
|
| 50 | + return true; |
|
| 51 | + } else if ($value == 'false') { |
|
| 52 | + return false; |
|
| 53 | + } else { |
|
| 54 | + return $value; |
|
| 55 | + } |
|
| 48 | 56 | } |
| 49 | 57 | |
| 50 | 58 | private function getOperator($field) { |
| 51 | 59 | if ($field[strlen($field)-1] == '!') { |
| 52 | 60 | return '!'; |
| 61 | + } else { |
|
| 62 | + return ''; |
|
| 53 | 63 | } |
| 54 | - else return ''; |
|
| 55 | 64 | } |
| 56 | 65 | |
| 57 | 66 | } |
| 58 | 67 | \ No newline at end of file |
@@ -24,7 +24,9 @@ |
||
| 24 | 24 | $xpath = new \DomXpath($element->ownerDocument); |
| 25 | 25 | |
| 26 | 26 | foreach ($xpath->query($xpathString) as $matchedElement) { |
| 27 | - if ($element->isSameNode($matchedElement)) return false; |
|
| 27 | + if ($element->isSameNode($matchedElement)) { |
|
| 28 | + return false; |
|
| 29 | + } |
|
| 28 | 30 | } |
| 29 | 31 | } |
| 30 | 32 | } |
@@ -15,8 +15,11 @@ |
||
| 15 | 15 | $bracketMatcher = new \Transphporm\Parser\BracketMatcher($element->getNodePath()); |
| 16 | 16 | $num = $bracketMatcher->match('[', ']'); |
| 17 | 17 | |
| 18 | - if (is_callable([$this, $criteria])) return $this->$criteria($num); |
|
| 19 | - else return $num == $criteria; |
|
| 18 | + if (is_callable([$this, $criteria])) { |
|
| 19 | + return $this->$criteria($num); |
|
| 20 | + } else { |
|
| 21 | + return $num == $criteria; |
|
| 22 | + } |
|
| 20 | 23 | } |
| 21 | 24 | return true; |
| 22 | 25 | } |