@@ -33,7 +33,9 @@ discard block |
||
| 33 | 33 | $rules = $this->writeRule($rules, $selector, $rule); |
| 34 | 34 | } |
| 35 | 35 | //there may be processing instructions at the end |
| 36 | - if ($processing = $this->processingInstructions($this->tss, $pos, strlen($this->tss), count($rules)+$indexStart)) $rules = array_merge($rules, $processing['rules']); |
|
| 36 | + if ($processing = $this->processingInstructions($this->tss, $pos, strlen($this->tss), count($rules)+$indexStart)) { |
|
| 37 | + $rules = array_merge($rules, $processing['rules']); |
|
| 38 | + } |
|
| 37 | 39 | usort($rules, [$this, 'sortRules']); |
| 38 | 40 | return $rules; |
| 39 | 41 | } |
@@ -63,8 +65,7 @@ discard block |
||
| 63 | 65 | $pos = strpos($tss, ';', $spacePos); |
| 64 | 66 | $args = substr($tss, $spacePos+1, $pos-$spacePos-1); |
| 65 | 67 | $rules = array_merge($rules, $this->$funcName($args, $indexStart)); |
| 66 | - } |
|
| 67 | - else { |
|
| 68 | + } else { |
|
| 68 | 69 | break; |
| 69 | 70 | } |
| 70 | 71 | } |
@@ -79,7 +80,9 @@ discard block |
||
| 79 | 80 | |
| 80 | 81 | private function sortRules($a, $b) { |
| 81 | 82 | //If they have the same depth, compare on index |
| 82 | - if ($a->depth === $b->depth) return $a->index < $b->index ? -1 : 1; |
|
| 83 | + if ($a->depth === $b->depth) { |
|
| 84 | + return $a->index < $b->index ? -1 : 1; |
|
| 85 | + } |
|
| 83 | 86 | |
| 84 | 87 | return ($a->depth < $b->depth) ? -1 : 1; |
| 85 | 88 | } |
@@ -100,7 +103,9 @@ discard block |
||
| 100 | 103 | $return = []; |
| 101 | 104 | |
| 102 | 105 | foreach ($rules as $rule) { |
| 103 | - if (trim($rule) === '') continue; |
|
| 106 | + if (trim($rule) === '') { |
|
| 107 | + continue; |
|
| 108 | + } |
|
| 104 | 109 | $parts = explode(':', $rule, 2); |
| 105 | 110 | |
| 106 | 111 | $parts[1] = $stringExtractor->rebuild($parts[1]); |