Conditions | 1 |
Paths | 1 |
Total Lines | 11 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | public static function generate($length = 6) { |
||
19 | $letters = str_shuffle('abcdefghijkmnopqrstwxyzABCDEFGHJKLMNPQRSTWXY'); |
||
20 | $numbers = str_shuffle('23456789'); |
||
21 | $specials = str_shuffle('@#&'); |
||
22 | |||
23 | $password = substr($letters, 0, $length - 3) |
||
24 | . substr($numbers, 0, 2) |
||
25 | . substr($specials, 0, 1); |
||
26 | |||
27 | return str_shuffle($password); |
||
28 | } |
||
29 | |||
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
SomeClass
to useself
instead: