| 1 | <?php |
||
| 6 | trait HasTextAttributes |
||
| 7 | { |
||
| 8 | /** |
||
| 9 | * Prepend the anchor with a string of html on render. |
||
| 10 | * |
||
| 11 | * @param string $prepend |
||
| 12 | * |
||
| 13 | * @return $this |
||
| 14 | */ |
||
| 15 | public function prepend(string $prepend) |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Prepend the text with a string of html on render if a certain condition is |
||
| 24 | * met. |
||
| 25 | * |
||
| 26 | * @param bool $condition |
||
| 27 | * @param string $prepend |
||
| 28 | * |
||
| 29 | * @return $this |
||
| 30 | */ |
||
| 31 | public function prependIf($condition, string $prepend) |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Append a text of html to the menu on render. |
||
| 42 | * |
||
| 43 | * @param string $append |
||
| 44 | * |
||
| 45 | * @return $this |
||
| 46 | */ |
||
| 47 | public function append(string $append) |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Append the text with a string of html on render if a certain condition is |
||
| 56 | * met. |
||
| 57 | * |
||
| 58 | * @param bool $condition |
||
| 59 | * @param string $append |
||
| 60 | * |
||
| 61 | * @return static |
||
| 62 | */ |
||
| 63 | public function appendIf($condition, string $append) |
||
| 71 | } |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: