| 1 | <?php |
||
| 8 | abstract class Password { |
||
| 9 | |||
| 10 | private static $salt = 'E50H%gDui#'; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * Retorna uma senha aleatoria |
||
| 14 | * A senha tem sempre pelo menos: 1 caracter especial e 2 numeros; |
||
| 15 | * @param int $length |
||
| 16 | * @return string |
||
| 17 | */ |
||
| 18 | public static function generate($length = 6) { |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Adiciona maior segurança a senha |
||
| 32 | * @param string $password |
||
| 33 | */ |
||
| 34 | public static function encrypt($password) { |
||
| 37 | |||
| 38 | } |
||
| 39 |
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: