| 1 | <?php namespace Arcanedev\LaravelHtml\Helpers; |
||
| 9 | class Label |
||
| 10 | { |
||
| 11 | /* ------------------------------------------------------------------------------------------------ |
||
| 12 | | Main Functions |
||
| 13 | | ------------------------------------------------------------------------------------------------ |
||
| 14 | */ |
||
| 15 | /** |
||
| 16 | * Create a form label element. |
||
| 17 | * |
||
| 18 | * @param string $name |
||
| 19 | * @param string $value |
||
| 20 | * @param array $attributes |
||
| 21 | * @param bool $escaped |
||
| 22 | * |
||
| 23 | * @return string |
||
| 24 | */ |
||
| 25 | 40 | public static function make($name, $value = null, array $attributes = [], $escaped = true) |
|
| 35 | |||
| 36 | /* ------------------------------------------------------------------------------------------------ |
||
| 37 | | Other Functions |
||
| 38 | | ------------------------------------------------------------------------------------------------ |
||
| 39 | */ |
||
| 40 | /** |
||
| 41 | * Format the label value. |
||
| 42 | * |
||
| 43 | * @param string $name |
||
| 44 | * @param string|null $value |
||
| 45 | * |
||
| 46 | * @return string |
||
| 47 | */ |
||
| 48 | 40 | private static function format($name, $value) |
|
| 52 | } |
||
| 53 |
Let’s assume you have a class which uses late-static binding:
}
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClassto useselfinstead: