1 | <?php namespace Arcanesoft\Core\Entities; |
||
9 | class YesOrNo |
||
10 | { |
||
11 | /* ----------------------------------------------------------------- |
||
12 | | Constants |
||
13 | | ----------------------------------------------------------------- |
||
14 | */ |
||
15 | |||
16 | const YES = 'yes'; |
||
17 | const NO = 'no'; |
||
18 | |||
19 | /* ----------------------------------------------------------------- |
||
20 | | All |
||
21 | | ----------------------------------------------------------------- |
||
22 | */ |
||
23 | |||
24 | /** |
||
25 | * Get all. |
||
26 | * |
||
27 | * @return \Illuminate\Support\Collection |
||
28 | */ |
||
29 | public static function all() |
||
35 | |||
36 | /** |
||
37 | * Get all keys. |
||
38 | * |
||
39 | * @return \Illuminate\Support\Collection |
||
40 | */ |
||
41 | 8 | public static function keys() |
|
45 | |||
46 | /** |
||
47 | * Get a translated YoN status. |
||
48 | * |
||
49 | * @param string|boolean $key |
||
50 | * @param null $default |
||
51 | * |
||
52 | * @return string|null |
||
53 | */ |
||
54 | 4 | public static function get($key, $default = null) |
|
58 | |||
59 | /* ----------------------------------------------------------------- |
||
60 | | Other Methods |
||
61 | | ----------------------------------------------------------------- |
||
62 | */ |
||
63 | |||
64 | /** |
||
65 | * Parse the key. |
||
66 | * |
||
67 | * @param string|boolean $key |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | 4 | private static function parseKey($key) |
|
75 | } |
||
76 |
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: