@@ -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 | } |
@@ -109,7 +116,9 @@ discard block |
||
| 109 | 116 | unset($newRules['repeat']); |
| 110 | 117 | |
| 111 | 118 | $hook = new Rule($newRules, $rule->getPseudoMatcher(), $this->data); |
| 112 | - foreach ($rule->getProperties() as $obj) $hook->registerProperties($obj); |
|
| 119 | + foreach ($rule->getProperties() as $obj) { |
|
| 120 | + $hook->registerProperties($obj); |
|
| 121 | + } |
|
| 113 | 122 | $hook->run($clone); |
| 114 | 123 | } |
| 115 | 124 | |
@@ -120,8 +129,11 @@ discard block |
||
| 120 | 129 | } |
| 121 | 130 | |
| 122 | 131 | public function display($value, $element) { |
| 123 | - if (strtolower($value[0]) === 'none') $element->setAttribute('transphporm', 'remove'); |
|
| 124 | - else $element->setAttribute('transphporm', 'show'); |
|
| 132 | + if (strtolower($value[0]) === 'none') { |
|
| 133 | + $element->setAttribute('transphporm', 'remove'); |
|
| 134 | + } else { |
|
| 135 | + $element->setAttribute('transphporm', 'show'); |
|
| 136 | + } |
|
| 125 | 137 | } |
| 126 | 138 | |
| 127 | 139 | public function bind($value, $element) { |