| @@ 128-149 (lines=22) @@ | ||
| 125 | * |
|
| 126 | * @return SimpleHtmlDomInterface|null |
|
| 127 | */ |
|
| 128 | public function __set($name, $value) |
|
| 129 | { |
|
| 130 | $nameOrig = $name; |
|
| 131 | $name = \strtolower($name); |
|
| 132 | ||
| 133 | switch ($name) { |
|
| 134 | case 'outerhtml': |
|
| 135 | case 'outertext': |
|
| 136 | return $this->replaceNodeWithString($value); |
|
| 137 | case 'innertext': |
|
| 138 | case 'innerhtml': |
|
| 139 | return $this->replaceChildWithString($value); |
|
| 140 | case 'plaintext': |
|
| 141 | return $this->replaceTextWithString($value); |
|
| 142 | default: |
|
| 143 | if ($this->node && \property_exists($this->node, $nameOrig)) { |
|
| 144 | return $this->node->{$nameOrig} = $value; |
|
| 145 | } |
|
| 146 | ||
| 147 | return $this->setAttribute($name, $value); |
|
| 148 | } |
|
| 149 | } |
|
| 150 | ||
| 151 | /** |
|
| 152 | * @return string |
|
| @@ 118-139 (lines=22) @@ | ||
| 115 | * |
|
| 116 | * @return SimpleXmlDomInterface|null |
|
| 117 | */ |
|
| 118 | public function __set($name, $value) |
|
| 119 | { |
|
| 120 | $nameOrig = $name; |
|
| 121 | $name = \strtolower($name); |
|
| 122 | ||
| 123 | switch ($name) { |
|
| 124 | case 'outerhtml': |
|
| 125 | case 'outertext': |
|
| 126 | return $this->replaceNodeWithString($value); |
|
| 127 | case 'innertext': |
|
| 128 | case 'innerhtml': |
|
| 129 | return $this->replaceChildWithString($value); |
|
| 130 | case 'plaintext': |
|
| 131 | return $this->replaceTextWithString($value); |
|
| 132 | default: |
|
| 133 | if ($this->node && \property_exists($this->node, $nameOrig)) { |
|
| 134 | return $this->node->{$nameOrig} = $value; |
|
| 135 | } |
|
| 136 | ||
| 137 | return $this->setAttribute($name, $value); |
|
| 138 | } |
|
| 139 | } |
|
| 140 | ||
| 141 | /** |
|
| 142 | * @return string |
|