@@ -26,13 +26,19 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | public function run(\DomElement $element) { |
| 28 | 28 | $this->functionSet->setElement($element); |
| 29 | - if ($this->origBaseDir !== $this->newBaseDir) $this->origBaseDir = $this->newBaseDir; |
|
| 29 | + if ($this->origBaseDir !== $this->newBaseDir) { |
|
| 30 | + $this->origBaseDir = $this->newBaseDir; |
|
| 31 | + } |
|
| 30 | 32 | //Don't run if there's a pseudo element like nth-child() and this element doesn't match it |
| 31 | - if (!$this->pseudoMatcher->matches($element)) return; |
|
| 33 | + if (!$this->pseudoMatcher->matches($element)) { |
|
| 34 | + return; |
|
| 35 | + } |
|
| 32 | 36 | |
| 33 | 37 | foreach ($this->rules as $name => $value) { |
| 34 | 38 | $result = $this->callProperty($name, $element, $this->getArgs($value, $element)); |
| 35 | - if ($result === false) break; |
|
| 39 | + if ($result === false) { |
|
| 40 | + break; |
|
| 41 | + } |
|
| 36 | 42 | } |
| 37 | 43 | } |
| 38 | 44 | |
@@ -45,8 +51,12 @@ discard block |
||
| 45 | 51 | } |
| 46 | 52 | |
| 47 | 53 | private function callProperty($name, $element, $value) { |
| 48 | - if (empty($value[0])) $value[0] = []; |
|
| 49 | - if (isset($this->properties[$name])) return $this->properties[$name]->run($value, $element, $this->rules, $this->pseudoMatcher, $this->properties); |
|
| 54 | + if (empty($value[0])) { |
|
| 55 | + $value[0] = []; |
|
| 56 | + } |
|
| 57 | + if (isset($this->properties[$name])) { |
|
| 58 | + return $this->properties[$name]->run($value, $element, $this->rules, $this->pseudoMatcher, $this->properties); |
|
| 59 | + } |
|
| 50 | 60 | return false; |
| 51 | 61 | } |
| 52 | 62 | } |