1 | <?php namespace XoopsModules\Mymenus; |
||
25 | */ |
||
26 | class Registry |
||
27 | { |
||
28 | protected $entries; |
||
29 | protected $locks; |
||
30 | |||
31 | /** |
||
32 | * |
||
33 | */ |
||
34 | protected function __construct() |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @return Registry |
||
42 | */ |
||
43 | public static function getInstance() |
||
44 | { |
||
45 | static $instance; |
||
46 | if (null === $instance) { |
||
47 | $instance = new static(); |
||
48 | } |
||
49 | |||
50 | return $instance; |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @TODO: move hard coded language string to language file |
||
55 | * |
||
56 | * @param $key |
||
57 | * @param $item |
||
58 | * |
||
59 | * @return bool |
||
60 | */ |
||
61 | public function setEntry($key, $item) |
||
62 | { |
||
63 | $ret = true; |
||
64 | if (true === $this->isLocked($key)) { |
||
65 | trigger_error("Unable to set entry `{$key}`. Entry is locked.", E_USER_WARNING); |
||
66 | |||
67 | $ret = false; |
||
68 | } |
||
69 | |||
70 | $this->entries[$key] = $item; |
||
71 | |||
72 | return $ret; |
||
73 | } |
||
74 | |||
75 | /** |
||
76 | * @param $key |
||
77 | */ |
||
78 | public function unsetEntry($key) |
||
79 | { |
||
80 | unset($this->entries[$key]); |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * @param $key |
||
85 | * |
||
86 | * @return null |
||
87 | */ |
||
88 | public function getEntry($key) |
||
95 | } |
||
96 | |||
97 | /** |
||
98 | * @param $key |
||
99 | * |
||
100 | * @return bool |
||
101 | */ |
||
102 | public function isEntry($key) |
||
105 | } |
||
106 | |||
107 | /** |
||
108 | * @param $key |
||
109 | * |
||
110 | * @return bool |
||
111 | */ |
||
112 | public function lockEntry($key) |
||
117 | } |
||
118 | |||
119 | /** |
||
120 | * @param $key |
||
121 | */ |
||
122 | public function unlockEntry($key) |
||
123 | { |
||
124 | unset($this->locks[$key]); |
||
125 | } |
||
126 | |||
127 | /** |
||
128 | * @param $key |
||
129 | * |
||
130 | * @return bool |
||
131 | */ |
||
132 | public function isLocked($key) |
||
133 | { |
||
134 | return (true === isset($this->locks[$key])); |
||
135 | } |
||
136 | |||
137 | public function unsetAll() |
||
141 | } |
||
142 | } |
||
143 |
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.