| 1 | <?php |
||
| 4 | class Helper |
||
| 5 | { |
||
| 6 | /** |
||
| 7 | * @param string $string |
||
| 8 | * @param bool $capitalizeFirstChar |
||
| 9 | * |
||
| 10 | * @return string |
||
| 11 | */ |
||
| 12 | public static function dashesToCamelCase($string, $capitalizeFirstChar = false) |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @param string $string |
||
| 19 | * @param bool $capitalizeFirstChar |
||
| 20 | * |
||
| 21 | * @return string |
||
| 22 | */ |
||
| 23 | public static function underscoreToCamelCase($string, $capitalizeFirstChar = false) |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @param int $length |
||
| 30 | * |
||
| 31 | * @return string |
||
| 32 | */ |
||
| 33 | public static function generateRandomString($length = 32) |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @param string $string |
||
| 54 | * @param string $symbol |
||
| 55 | * @param bool $capitalizeFirstChar |
||
| 56 | * |
||
| 57 | * @return mixed|string |
||
| 58 | */ |
||
| 59 | private static function replace($string, $symbol, $capitalizeFirstChar = false) |
||
| 69 | } |
||
| 70 |
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: