@@ -35,17 +35,19 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | public function addContent($content, $before = false) { |
| 37 | 37 | if (! \is_array($this->content)) { |
| 38 | - if (isset($this->content)) |
|
| 39 | - $this->content = array( |
|
| 38 | + if (isset($this->content)) { |
|
| 39 | + $this->content = array( |
|
| 40 | 40 | $this->content |
| 41 | 41 | ); |
| 42 | - else |
|
| 43 | - $this->content = array(); |
|
| 42 | + } else { |
|
| 43 | + $this->content = array(); |
|
| 44 | + } |
|
| 45 | + } |
|
| 46 | + if ($before) { |
|
| 47 | + \array_unshift($this->content, $content); |
|
| 48 | + } else { |
|
| 49 | + $this->content[] = $content; |
|
| 44 | 50 | } |
| 45 | - if ($before) |
|
| 46 | - \array_unshift($this->content, $content); |
|
| 47 | - else |
|
| 48 | - $this->content[] = $content; |
|
| 49 | 51 | return $this; |
| 50 | 52 | } |
| 51 | 53 | |
@@ -108,10 +110,12 @@ discard block |
||
| 108 | 110 | * @return HtmlDoubleElement |
| 109 | 111 | */ |
| 110 | 112 | public function asLink($href = NULL, $target = NULL) { |
| 111 | - if (isset($href)) |
|
| 112 | - $this->setProperty("href", $href); |
|
| 113 | - if (isset($target)) |
|
| 114 | - $this->setProperty("target", $target); |
|
| 113 | + if (isset($href)) { |
|
| 114 | + $this->setProperty("href", $href); |
|
| 115 | + } |
|
| 116 | + if (isset($target)) { |
|
| 117 | + $this->setProperty("target", $target); |
|
| 118 | + } |
|
| 115 | 119 | return $this->setTagName("a"); |
| 116 | 120 | } |
| 117 | 121 | |