| @@ 270-281 (lines=12) @@ | ||
| 267 | * @return $this |
|
| 268 | * @throws \InvalidArgumentException |
|
| 269 | */ |
|
| 270 | public function append($data) |
|
| 271 | { |
|
| 272 | if (is_array($this->data)) { |
|
| 273 | array_push($this->data, $data); |
|
| 274 | } else if (is_string($data)) { |
|
| 275 | $this->data .= (string) $data; |
|
| 276 | } else { |
|
| 277 | throw new \InvalidArgumentException('$data must be either array nor string.'); |
|
| 278 | } |
|
| 279 | ||
| 280 | return $this; |
|
| 281 | } |
|
| 282 | ||
| 283 | ||
| 284 | /** |
|
| @@ 289-300 (lines=12) @@ | ||
| 286 | * @return $this |
|
| 287 | * @throws \InvalidArgumentException |
|
| 288 | */ |
|
| 289 | public function prepend($data) |
|
| 290 | { |
|
| 291 | if (is_array($this->data)) { |
|
| 292 | array_unshift($this->data, $data); |
|
| 293 | } else if (is_string($data)) { |
|
| 294 | $this->data = (string) $data . $this->data; |
|
| 295 | } else { |
|
| 296 | throw new \InvalidArgumentException('$data must be either array nor string.'); |
|
| 297 | } |
|
| 298 | ||
| 299 | return $this; |
|
| 300 | } |
|
| 301 | ||
| 302 | /** |
|
| 303 | * @param $tagName |
|