@@ -63,12 +63,15 @@ discard block |
||
| 63 | 63 | $node = $element->ownerDocument->importNode($node, true); |
| 64 | 64 | $element->appendChild($node); |
| 65 | 65 | } |
| 66 | + } else { |
|
| 67 | + $element->appendChild($element->ownerDocument->createTextNode(implode('', $content))); |
|
| 66 | 68 | } |
| 67 | - else $element->appendChild($element->ownerDocument->createTextNode(implode('', $content))); |
|
| 68 | 69 | } |
| 69 | 70 | |
| 70 | 71 | private function removeAllChildren($element) { |
| 71 | - while ($element->hasChildNodes()) $element->removeChild($element->firstChild); |
|
| 72 | + while ($element->hasChildNodes()) { |
|
| 73 | + $element->removeChild($element->firstChild); |
|
| 74 | + } |
|
| 72 | 75 | } |
| 73 | 76 | |
| 74 | 77 | public function registerFormatter($formatter) { |
@@ -76,11 +79,15 @@ discard block |
||
| 76 | 79 | } |
| 77 | 80 | |
| 78 | 81 | private function format($value, $rules) { |
| 79 | - if (!isset($rules['format'])) return $value; |
|
| 82 | + if (!isset($rules['format'])) { |
|
| 83 | + return $value; |
|
| 84 | + } |
|
| 80 | 85 | $format = new \Transphporm\StringExtractor($rules['format']); |
| 81 | 86 | $options = explode(' ', $format); |
| 82 | 87 | $functionName = array_shift($options); |
| 83 | - foreach ($options as &$f) $f = trim($format->rebuild($f), '"'); |
|
| 88 | + foreach ($options as &$f) { |
|
| 89 | + $f = trim($format->rebuild($f), '"'); |
|
| 90 | + } |
|
| 84 | 91 | |
| 85 | 92 | return $this->processFormat($options, $functionName, $value); |
| 86 | 93 | } |
@@ -98,12 +105,16 @@ discard block |
||
| 98 | 105 | |
| 99 | 106 | private function createHook($newRules, $rule) { |
| 100 | 107 | $hook = new Rule($newRules, $rule->getPseudoMatcher(), $this->data); |
| 101 | - foreach ($rule->getProperties() as $obj) $hook->registerProperties($obj); |
|
| 108 | + foreach ($rule->getProperties() as $obj) { |
|
| 109 | + $hook->registerProperties($obj); |
|
| 110 | + } |
|
| 102 | 111 | return $hook; |
| 103 | 112 | } |
| 104 | 113 | |
| 105 | 114 | public function repeat($value, $element, $rule) { |
| 106 | - if ($element->getAttribute('transphporm') === 'added') return $element->parentNode->removeChild($element); |
|
| 115 | + if ($element->getAttribute('transphporm') === 'added') { |
|
| 116 | + return $element->parentNode->removeChild($element); |
|
| 117 | + } |
|
| 107 | 118 | |
| 108 | 119 | foreach ($value as $key => $iteration) { |
| 109 | 120 | $clone = $element->cloneNode(true); |
@@ -127,8 +138,11 @@ discard block |
||
| 127 | 138 | } |
| 128 | 139 | |
| 129 | 140 | public function display($value, $element) { |
| 130 | - if (strtolower($value[0]) === 'none') $element->setAttribute('transphporm', 'remove'); |
|
| 131 | - else $element->setAttribute('transphporm', 'show'); |
|
| 141 | + if (strtolower($value[0]) === 'none') { |
|
| 142 | + $element->setAttribute('transphporm', 'remove'); |
|
| 143 | + } else { |
|
| 144 | + $element->setAttribute('transphporm', 'show'); |
|
| 145 | + } |
|
| 132 | 146 | } |
| 133 | 147 | |
| 134 | 148 | public function bind($value, $element) { |