| Conditions | 7 |
| Paths | 7 |
| Total Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | private static function getPool($type = 'alnum') |
||
| 13 | { |
||
| 14 | switch ($type) { |
||
| 15 | case 'alnum': |
||
| 16 | $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
||
| 17 | break; |
||
| 18 | case 'alpha': |
||
| 19 | $pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
||
| 20 | break; |
||
| 21 | case 'hexdec': |
||
| 22 | $pool = '0123456789abcdef'; |
||
| 23 | break; |
||
| 24 | case 'numeric': |
||
| 25 | $pool = '0123456789'; |
||
| 26 | break; |
||
| 27 | case 'nozero': |
||
| 28 | $pool = '123456789'; |
||
| 29 | break; |
||
| 30 | case 'distinct': |
||
| 31 | $pool = '2345679ACDEFHJKLMNPRSTUVWXYZ'; |
||
| 32 | break; |
||
| 33 | default: |
||
| 34 | $pool = (string) $type; |
||
| 35 | break; |
||
| 36 | } |
||
| 37 | |||
| 38 | return $pool; |
||
| 39 | } |
||
| 40 | |||
| 83 |
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: