@@ -22,15 +22,22 @@ discard block |
||
| 22 | 22 | //Remove the current contents |
| 23 | 23 | $this->removeAllChildren($element); |
| 24 | 24 | |
| 25 | - if ($this->getContentMode($rule->getRules()) === 'replace') $this->replaceContent($element, $value); |
|
| 25 | + if ($this->getContentMode($rule->getRules()) === 'replace') { |
|
| 26 | + $this->replaceContent($element, $value); |
|
| 27 | + } |
|
| 26 | 28 | //Now make a text node |
| 27 | - else $this->appendContent($element, $value); |
|
| 29 | + else { |
|
| 30 | + $this->appendContent($element, $value); |
|
| 31 | + } |
|
| 28 | 32 | } |
| 29 | 33 | } |
| 30 | 34 | |
| 31 | 35 | private function getContentMode($rules) { |
| 32 | - if (isset($rules['content-mode'])) return $rules['content-mode']; |
|
| 33 | - else return 'append'; |
|
| 36 | + if (isset($rules['content-mode'])) { |
|
| 37 | + return $rules['content-mode']; |
|
| 38 | + } else { |
|
| 39 | + return 'append'; |
|
| 40 | + } |
|
| 34 | 41 | } |
| 35 | 42 | |
| 36 | 43 | private function processPseudo($value, $element, $rule) { |
@@ -71,8 +78,7 @@ discard block |
||
| 71 | 78 | $node = $element->ownerDocument->importNode($node, true); |
| 72 | 79 | $element->parentNode->appendChild($node); |
| 73 | 80 | } |
| 74 | - } |
|
| 75 | - else { |
|
| 81 | + } else { |
|
| 76 | 82 | $element->parentNode->appendChild($element->ownerDocument->createElement('span', implode('', $content))); |
| 77 | 83 | } |
| 78 | 84 | $element->setAttribute('transphporm', 'remove'); |
@@ -84,22 +90,29 @@ discard block |
||
| 84 | 90 | $node = $element->ownerDocument->importNode($node, true); |
| 85 | 91 | $element->appendChild($node); |
| 86 | 92 | } |
| 93 | + } else { |
|
| 94 | + $element->appendChild($element->ownerDocument->createTextNode(implode('', $content))); |
|
| 87 | 95 | } |
| 88 | - else $element->appendChild($element->ownerDocument->createTextNode(implode('', $content))); |
|
| 89 | 96 | } |
| 90 | 97 | |
| 91 | 98 | private function removeAllChildren($element) { |
| 92 | - while ($element->hasChildNodes()) $element->removeChild($element->firstChild); |
|
| 99 | + while ($element->hasChildNodes()) { |
|
| 100 | + $element->removeChild($element->firstChild); |
|
| 101 | + } |
|
| 93 | 102 | } |
| 94 | 103 | |
| 95 | 104 | private function createHook($newRules, $rule) { |
| 96 | 105 | $hook = new Rule($newRules, $rule->getPseudoMatcher(), $this->data); |
| 97 | - foreach ($rule->getProperties() as $obj) $hook->registerProperties($obj); |
|
| 106 | + foreach ($rule->getProperties() as $obj) { |
|
| 107 | + $hook->registerProperties($obj); |
|
| 108 | + } |
|
| 98 | 109 | return $hook; |
| 99 | 110 | } |
| 100 | 111 | |
| 101 | 112 | public function repeat($value, $element, $rule) { |
| 102 | - if ($element->getAttribute('transphporm') === 'added') return $element->parentNode->removeChild($element); |
|
| 113 | + if ($element->getAttribute('transphporm') === 'added') { |
|
| 114 | + return $element->parentNode->removeChild($element); |
|
| 115 | + } |
|
| 103 | 116 | |
| 104 | 117 | foreach ($value as $key => $iteration) { |
| 105 | 118 | $clone = $element->cloneNode(true); |
@@ -123,8 +136,11 @@ discard block |
||
| 123 | 136 | } |
| 124 | 137 | |
| 125 | 138 | public function display($value, $element) { |
| 126 | - if (strtolower($value[0]) === 'none') $element->setAttribute('transphporm', 'remove'); |
|
| 127 | - else $element->setAttribute('transphporm', 'show'); |
|
| 139 | + if (strtolower($value[0]) === 'none') { |
|
| 140 | + $element->setAttribute('transphporm', 'remove'); |
|
| 141 | + } else { |
|
| 142 | + $element->setAttribute('transphporm', 'show'); |
|
| 143 | + } |
|
| 128 | 144 | } |
| 129 | 145 | |
| 130 | 146 | public function bind($value, $element) { |