Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like EE_Registry often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use EE_Registry, and based on these observations, apply Extract Interface, too.
1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
||
11 | class EE_Registry { |
||
12 | |||
13 | /** |
||
14 | * EE_Registry Object |
||
15 | * |
||
16 | * @var EE_Registry $_instance |
||
17 | * @access private |
||
18 | */ |
||
19 | private static $_instance = null; |
||
20 | |||
21 | /** |
||
22 | * @var EE_Dependency_Map $_dependency_map |
||
23 | * @access protected |
||
24 | */ |
||
25 | protected $_dependency_map = null; |
||
26 | |||
27 | /** |
||
28 | * @var array $_class_abbreviations |
||
29 | * @access protected |
||
30 | */ |
||
31 | protected $_class_abbreviations = array(); |
||
32 | |||
33 | /** |
||
34 | * EE_Cart Object |
||
35 | * @access public |
||
36 | * @var EE_Cart $CART |
||
37 | */ |
||
38 | public $CART = null; |
||
39 | |||
40 | /** |
||
41 | * EE_Config Object |
||
42 | * @access public |
||
43 | * @var EE_Config $CFG |
||
44 | */ |
||
45 | public $CFG = null; |
||
46 | |||
47 | /** |
||
48 | * EE_Network_Config Object |
||
49 | * @access public |
||
50 | * @var EE_Network_Config $NET_CFG |
||
51 | */ |
||
52 | public $NET_CFG = null; |
||
53 | |||
54 | /** |
||
55 | * StdClass object for storing library classes in |
||
56 | * |
||
57 | * @public LIB |
||
58 | * @var StdClass $LIB |
||
59 | */ |
||
60 | public $LIB = null; |
||
61 | |||
62 | /** |
||
63 | * EE_Request_Handler Object |
||
64 | * @access public |
||
65 | * @var EE_Request_Handler $REQ |
||
66 | */ |
||
67 | public $REQ = null; |
||
68 | |||
69 | /** |
||
70 | * EE_Session Object |
||
71 | * @access public |
||
72 | * @var EE_Session $SSN |
||
73 | */ |
||
74 | public $SSN = null; |
||
75 | |||
76 | /** |
||
77 | * holds the ee capabilities object. |
||
78 | * |
||
79 | * @since 4.5.0 |
||
80 | * |
||
81 | * @var EE_Capabilities |
||
82 | */ |
||
83 | public $CAP = null; |
||
84 | |||
85 | /** |
||
86 | * holds the EE_Message_Resource_Manager object. |
||
87 | * |
||
88 | * @since 4.9.0 |
||
89 | * |
||
90 | * @var EE_Message_Resource_Manager |
||
91 | */ |
||
92 | public $MRM = null; |
||
93 | |||
94 | /** |
||
95 | * $addons - StdClass object for holding addons which have registered themselves to work with EE core |
||
96 | * @access public |
||
97 | * @var EE_Addon[] |
||
98 | */ |
||
99 | public $addons = null; |
||
100 | |||
101 | /** |
||
102 | * $models |
||
103 | * @access public |
||
104 | * @var EEM_Base[] $models keys are 'short names' (eg Event), values are class names (eg 'EEM_Event') |
||
105 | */ |
||
106 | public $models = array(); |
||
107 | |||
108 | /** |
||
109 | * $modules |
||
110 | * @access public |
||
111 | * @var EED_Module[] $modules |
||
112 | */ |
||
113 | public $modules = null; |
||
114 | |||
115 | /** |
||
116 | * $shortcodes |
||
117 | * @access public |
||
118 | * @var EES_Shortcode[] $shortcodes |
||
119 | */ |
||
120 | public $shortcodes = null; |
||
121 | |||
122 | /** |
||
123 | * $widgets |
||
124 | * @access public |
||
125 | * @var WP_Widget[] $widgets |
||
126 | */ |
||
127 | public $widgets = null; |
||
128 | |||
129 | /** |
||
130 | * $non_abstract_db_models |
||
131 | * @access public |
||
132 | * @var array this is an array of all implemented model names (i.e. not the parent abstract models, or models |
||
133 | * which don't actually fetch items from the DB in the normal way (ie, are not children of EEM_Base)). |
||
134 | * Keys are model "short names" (eg "Event") as used in model relations, and values are |
||
135 | * classnames (eg "EEM_Event") |
||
136 | */ |
||
137 | public $non_abstract_db_models = array(); |
||
138 | |||
139 | /** |
||
140 | * $i18n_js_strings - internationalization for JS strings |
||
141 | * usage: EE_Registry::i18n_js_strings['string_key'] = __( 'string to translate.', 'event_espresso' ); |
||
142 | * in js file: var translatedString = eei18n.string_key; |
||
143 | * |
||
144 | * @access public |
||
145 | * @var array |
||
146 | */ |
||
147 | public static $i18n_js_strings = array(); |
||
148 | |||
149 | /** |
||
150 | * $main_file - path to espresso.php |
||
151 | * |
||
152 | * @access public |
||
153 | * @var array |
||
154 | */ |
||
155 | public $main_file; |
||
156 | |||
157 | /** |
||
158 | * array of ReflectionClass objects where the key is the class name |
||
159 | * |
||
160 | * @access public |
||
161 | * @var ReflectionClass[] |
||
162 | */ |
||
163 | public $_reflectors; |
||
164 | |||
165 | /** |
||
166 | * boolean flag to indicate whether or not to load/save dependencies from/to the cache |
||
167 | * |
||
168 | * @access protected |
||
169 | * @var boolean $_cache_on |
||
170 | */ |
||
171 | protected $_cache_on = true; |
||
172 | |||
173 | |||
174 | |||
175 | /** |
||
176 | * @singleton method used to instantiate class object |
||
177 | * @access public |
||
178 | * @param \EE_Dependency_Map $dependency_map |
||
179 | * @return \EE_Registry instance |
||
180 | */ |
||
181 | public static function instance( \EE_Dependency_Map $dependency_map = null ) { |
||
188 | |||
189 | |||
190 | |||
191 | /** |
||
192 | *protected constructor to prevent direct creation |
||
193 | * |
||
194 | * @Constructor |
||
195 | * @access protected |
||
196 | * @param \EE_Dependency_Map $dependency_map |
||
197 | * @return \EE_Registry |
||
198 | */ |
||
199 | protected function __construct( \EE_Dependency_Map $dependency_map ) { |
||
203 | |||
204 | |||
205 | |||
206 | /** |
||
207 | * initialize |
||
208 | */ |
||
209 | public function initialize() { |
||
242 | |||
243 | |||
244 | |||
245 | /** |
||
246 | * init |
||
247 | * |
||
248 | * @access public |
||
249 | * @return void |
||
250 | */ |
||
251 | public function init() { |
||
258 | |||
259 | |||
260 | |||
261 | /** |
||
262 | * localize_i18n_js_strings |
||
263 | * |
||
264 | * @return string |
||
265 | */ |
||
266 | public static function localize_i18n_js_strings() { |
||
276 | |||
277 | |||
278 | |||
279 | /** |
||
280 | * @param mixed string | EED_Module $module |
||
281 | */ |
||
282 | public function add_module( $module ) { |
||
293 | |||
294 | |||
295 | |||
296 | /** |
||
297 | * @param string $module_name |
||
298 | * @return mixed EED_Module | NULL |
||
299 | */ |
||
300 | public function get_module( $module_name = '' ) { |
||
303 | |||
304 | |||
305 | |||
306 | /** |
||
307 | * loads core classes - must be singletons |
||
308 | * |
||
309 | * @access public |
||
310 | * @param string $class_name - simple class name ie: session |
||
311 | * @param mixed $arguments |
||
312 | * @param bool $load_only |
||
313 | * @return mixed |
||
314 | */ |
||
315 | public function load_core( $class_name, $arguments = array(), $load_only = false ) { |
||
330 | |||
331 | |||
332 | |||
333 | /** |
||
334 | * loads service classes |
||
335 | * |
||
336 | * @access public |
||
337 | * @param string $class_name - simple class name ie: session |
||
338 | * @param mixed $arguments |
||
339 | * @param bool $load_only |
||
340 | * @return mixed |
||
341 | */ |
||
342 | public function load_service( $class_name, $arguments = array(), $load_only = false ) { |
||
352 | |||
353 | |||
354 | |||
355 | /** |
||
356 | * loads data_migration_scripts |
||
357 | * |
||
358 | * @access public |
||
359 | * @param string $class_name - class name for the DMS ie: EE_DMS_Core_4_2_0 |
||
360 | * @param mixed $arguments |
||
361 | * @return EE_Data_Migration_Script_Base |
||
362 | */ |
||
363 | public function load_dms( $class_name, $arguments = array() ) { |
||
367 | |||
368 | |||
369 | |||
370 | /** |
||
371 | * loads object creating classes - must be singletons |
||
372 | * |
||
373 | * @param string $class_name - simple class name ie: attendee |
||
374 | * @param mixed $arguments - an array of arguments to pass to the class |
||
375 | * @param bool $from_db - some classes are instantiated from the db and thus call a different method to instantiate |
||
376 | * @param bool $cache if you don't want the class to be stored in the internal cache (non-persistent) then set this to FALSE (ie. when instantiating model objects from client in a loop) |
||
377 | * @param bool $load_only whether or not to just load the file and NOT instantiate, or load AND instantiate (default) |
||
378 | * @return EE_Base_Class | bool |
||
379 | */ |
||
380 | public function load_class( $class_name, $arguments = array(), $from_db = false, $cache = true, $load_only = false ) { |
||
389 | |||
390 | |||
391 | |||
392 | /** |
||
393 | * loads helper classes - must be singletons |
||
394 | * |
||
395 | * @param string $class_name - simple class name ie: price |
||
396 | * @param mixed $arguments |
||
397 | * @param bool $load_only |
||
398 | * @return EEH_Base | bool |
||
399 | */ |
||
400 | public function load_helper( $class_name, $arguments = array(), $load_only = true ) { |
||
406 | |||
407 | |||
408 | |||
409 | /** |
||
410 | * loads core classes - must be singletons |
||
411 | * |
||
412 | * @access public |
||
413 | * @param string $class_name - simple class name ie: session |
||
414 | * @param mixed $arguments |
||
415 | * @param bool $load_only |
||
416 | * @param bool $cache whether to cache the object or not. |
||
417 | * @return mixed |
||
418 | */ |
||
419 | public function load_lib( $class_name, $arguments = array(), $load_only = false, $cache = true ) { |
||
430 | |||
431 | |||
432 | |||
433 | /** |
||
434 | * loads model classes - must be singletons |
||
435 | * |
||
436 | * @param string $class_name - simple class name ie: price |
||
437 | * @param mixed $arguments |
||
438 | * @param bool $load_only |
||
439 | * @return EEM_Base | bool |
||
440 | */ |
||
441 | public function load_model( $class_name, $arguments = array(), $load_only = false ) { |
||
449 | |||
450 | |||
451 | |||
452 | /** |
||
453 | * loads model classes - must be singletons |
||
454 | * |
||
455 | * @param string $class_name - simple class name ie: price |
||
456 | * @param mixed $arguments |
||
457 | * @param bool $load_only |
||
458 | * @return mixed | bool |
||
459 | */ |
||
460 | public function load_model_class( $class_name, $arguments = array(), $load_only = true ) { |
||
470 | |||
471 | |||
472 | |||
473 | /** |
||
474 | * Determines if $model_name is the name of an actual EE model. |
||
475 | * @param string $model_name like Event, Attendee, Question_Group_Question, etc. |
||
476 | * @return boolean |
||
477 | */ |
||
478 | public function is_model_name( $model_name ) { |
||
481 | |||
482 | |||
483 | |||
484 | /** |
||
485 | * generic class loader |
||
486 | * |
||
487 | * @param string $path_to_file - directory path to file location, not including filename |
||
488 | * @param string $file_name - file name ie: my_file.php, including extension |
||
489 | * @param string $type - file type - core? class? helper? model? |
||
490 | * @param mixed $arguments |
||
491 | * @param bool $load_only |
||
492 | * @return mixed |
||
493 | */ |
||
494 | public function load_file( $path_to_file, $file_name, $type = '', $arguments = array(), $load_only = true ) { |
||
498 | |||
499 | |||
500 | |||
501 | /** |
||
502 | * load_addon |
||
503 | * |
||
504 | * @param string $path_to_file - directory path to file location, not including filename |
||
505 | * @param string $class_name - full class name ie: My_Class |
||
506 | * @param string $type - file type - core? class? helper? model? |
||
507 | * @param mixed $arguments |
||
508 | * @param bool $load_only |
||
509 | * @return EE_Addon |
||
510 | */ |
||
511 | public function load_addon( $path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = false ) { |
||
515 | |||
516 | |||
517 | |||
518 | /** |
||
519 | * loads and tracks classes |
||
520 | * |
||
521 | * @param array $file_paths |
||
522 | * @param string $class_prefix - EE or EEM or... ??? |
||
523 | * @param bool|string $class_name - $class name |
||
524 | * @param string $type - file type - core? class? helper? model? |
||
525 | * @param mixed $arguments - an argument or array of arguments to pass to the class upon instantiation |
||
526 | * @param bool $from_db - some classes are instantiated from the db and thus call a different method to instantiate |
||
527 | * @param bool $cache |
||
528 | * @param bool $load_only |
||
529 | * @return null|object|bool null = failure to load or instantiate class object. |
||
530 | * object = class loaded and instantiated successfully. |
||
531 | * bool = fail or success when $load_only is true |
||
532 | */ |
||
533 | protected function _load( |
||
588 | |||
589 | |||
590 | |||
591 | /** |
||
592 | * _get_cached_class |
||
593 | * |
||
594 | * attempts to find a cached version of the requested class |
||
595 | * by looking in the following places: |
||
596 | * $this->{$class_abbreviation} ie: $this->CART |
||
597 | * $this->{$class_name} ie: $this->Some_Class |
||
598 | * $this->LIB->{$class_name} ie: $this->LIB->Some_Class |
||
599 | * $this->addon->{$class_name} ie: $this->addon->Some_Addon_Class |
||
600 | * |
||
601 | * @access protected |
||
602 | * @param string $class_name |
||
603 | * @param string $class_prefix |
||
604 | * @return null|object |
||
605 | */ |
||
606 | protected function _get_cached_class( $class_name, $class_prefix = '' ) { |
||
625 | |||
626 | |||
627 | |||
628 | /** |
||
629 | * _resolve_path |
||
630 | * |
||
631 | * attempts to find a full valid filepath for the requested class. |
||
632 | * loops thru each of the base paths in the $file_paths array and appends : "{classname} . {file type} . php" |
||
633 | * then returns that path if the target file has been found and is readable |
||
634 | * |
||
635 | * @access protected |
||
636 | * @param string $class_name |
||
637 | * @param string $type |
||
638 | * @param array $file_paths |
||
639 | * @return string | bool |
||
640 | */ |
||
641 | protected function _resolve_path( $class_name, $type = '', $file_paths = array() ) { |
||
659 | |||
660 | |||
661 | |||
662 | /** |
||
663 | * _require_file |
||
664 | * |
||
665 | * basically just performs a require_once() |
||
666 | * but with some error handling |
||
667 | * |
||
668 | * @access protected |
||
669 | * @param string $path |
||
670 | * @param string $class_name |
||
671 | * @param string $type |
||
672 | * @param array $file_paths |
||
673 | * @return boolean |
||
674 | * @throws \EE_Error |
||
675 | */ |
||
676 | protected function _require_file( $path, $class_name, $type = '', $file_paths = array() ) { |
||
712 | |||
713 | |||
714 | |||
715 | /** |
||
716 | * _create_object |
||
717 | * Attempts to instantiate the requested class via any of the |
||
718 | * commonly used instantiation methods employed throughout EE. |
||
719 | * The priority for instantiation is as follows: |
||
720 | * - abstract classes or any class flagged as "load only" (no instantiation occurs) |
||
721 | * - model objects via their 'new_instance_from_db' method |
||
722 | * - model objects via their 'new_instance' method |
||
723 | * - "singleton" classes" via their 'instance' method |
||
724 | * - standard instantiable classes via their __constructor |
||
725 | * Prior to instantiation, if the classname exists in the dependency_map, |
||
726 | * then the constructor for the requested class will be examined to determine |
||
727 | * if any dependencies exist, and if they can be injected. |
||
728 | * If so, then those classes will be added to the array of arguments passed to the constructor |
||
729 | * |
||
730 | * @access protected |
||
731 | * @param string $class_name |
||
732 | * @param array $arguments |
||
733 | * @param string $type |
||
734 | * @param bool $from_db |
||
735 | * @return null | object |
||
736 | * @throws \EE_Error |
||
737 | */ |
||
738 | protected function _create_object( $class_name, $arguments = array(), $type = '', $from_db = false ) { |
||
792 | |||
793 | |||
794 | |||
795 | /** |
||
796 | * @see http://stackoverflow.com/questions/173400/how-to-check-if-php-array-is-associative-or-sequential |
||
797 | * @param array $array |
||
798 | * @return bool |
||
799 | */ |
||
800 | protected function _array_is_numerically_and_sequentially_indexed( array $array ) { |
||
803 | |||
804 | |||
805 | |||
806 | /** |
||
807 | * getReflectionClass |
||
808 | * |
||
809 | * checks if a ReflectionClass object has already been generated for a class |
||
810 | * and returns that instead of creating a new one |
||
811 | * |
||
812 | * @access public |
||
813 | * @param string $class_name |
||
814 | * @return ReflectionClass |
||
815 | */ |
||
816 | public function get_ReflectionClass( $class_name ) { |
||
825 | |||
826 | |||
827 | |||
828 | /** |
||
829 | * _resolve_dependencies |
||
830 | * |
||
831 | * examines the constructor for the requested class to determine |
||
832 | * if any dependencies exist, and if they can be injected. |
||
833 | * If so, then those classes will be added to the array of arguments passed to the constructor |
||
834 | * PLZ NOTE: this is achieved by type hinting the constructor params |
||
835 | * For example: |
||
836 | * if attempting to load a class "Foo" with the following constructor: |
||
837 | * __construct( Bar $bar_class, Fighter $grohl_class ) |
||
838 | * then $bar_class and $grohl_class will be added to the $arguments array, |
||
839 | * but only IF they are NOT already present in the incoming arguments array, |
||
840 | * and the correct classes can be loaded |
||
841 | * |
||
842 | * @access protected |
||
843 | * @param ReflectionClass $reflector |
||
844 | * @param string $class_name |
||
845 | * @param array $arguments |
||
846 | * @return array |
||
847 | */ |
||
848 | protected function _resolve_dependencies( ReflectionClass $reflector, $class_name, $arguments = array() ) { |
||
892 | |||
893 | |||
894 | |||
895 | /** |
||
896 | * @access protected |
||
897 | * @param string $class_name |
||
898 | * @param string $param_class |
||
899 | * @param array $arguments |
||
900 | * @param mixed $index |
||
901 | * @return array |
||
902 | */ |
||
903 | protected function _resolve_dependency( $class_name, $param_class , $arguments, $index ) { |
||
941 | |||
942 | |||
943 | |||
944 | /** |
||
945 | * _set_cached_class |
||
946 | * |
||
947 | * attempts to cache the instantiated class locally |
||
948 | * in one of the following places, in the following order: |
||
949 | * $this->{class_abbreviation} ie: $this->CART |
||
950 | * $this->{$class_name} ie: $this->Some_Class |
||
951 | * $this->addon->{$$class_name} ie: $this->addon->Some_Addon_Class |
||
952 | * $this->LIB->{$class_name} ie: $this->LIB->Some_Class |
||
953 | * |
||
954 | * @access protected |
||
955 | * @param object $class_obj |
||
956 | * @param string $class_name |
||
957 | * @param string $class_prefix |
||
958 | * @param bool $from_db |
||
959 | * @return void |
||
960 | */ |
||
961 | protected function _set_cached_class( $class_obj, $class_name, $class_prefix = '', $from_db = false ) { |
||
974 | |||
975 | |||
976 | |||
977 | /** |
||
978 | * call any loader that's been registered in the EE_Dependency_Map::$_class_loaders array |
||
979 | * |
||
980 | * |
||
981 | * @param string $classname PLEASE NOTE: the class name needs to match what's registered |
||
982 | * in the EE_Dependency_Map::$_class_loaders array, |
||
983 | * including the class prefix, ie: "EE_", "EEM_", "EEH_", etc |
||
984 | * @param array $arguments |
||
985 | * @return object |
||
986 | */ |
||
987 | public static function factory( $classname, $arguments = array() ) { |
||
996 | |||
997 | |||
998 | |||
999 | /** |
||
1000 | * Gets the addon by its name/slug (not classname. For that, just |
||
1001 | * use the classname as the property name on EE_Config::instance()->addons) |
||
1002 | * @param string $name |
||
1003 | * @return EE_Addon |
||
1004 | */ |
||
1005 | public function get_addon_by_name( $name ) { |
||
1013 | |||
1014 | |||
1015 | |||
1016 | /** |
||
1017 | * Gets an array of all the registered addons, where the keys are their names. (ie, what each returns for their name() function) They're already available on EE_Config::instance()->addons as properties, where each property's name is the addon's classname. So if you just want to get the addon by classname, use EE_Config::instance()->addons->{classname} |
||
1018 | * |
||
1019 | * @return EE_Addon[] where the KEYS are the addon's name() |
||
1020 | */ |
||
1021 | public function get_addons_by_name() { |
||
1028 | |||
1029 | |||
1030 | |||
1031 | /** |
||
1032 | * Resets the specified model's instance AND makes sure EE_Registry doesn't keep |
||
1033 | * a stale copy of it around |
||
1034 | * |
||
1035 | * @param string $model_name |
||
1036 | * @return \EEM_Base |
||
1037 | * @throws \EE_Error |
||
1038 | */ |
||
1039 | public function reset_model( $model_name ) { |
||
1050 | |||
1051 | |||
1052 | |||
1053 | /** |
||
1054 | * Resets the registry. |
||
1055 | * |
||
1056 | * The criteria for what gets reset is based on what can be shared between sites on the same request when switch_to_blog |
||
1057 | * is used in a multisite install. Here is a list of things that are NOT reset. |
||
1058 | * |
||
1059 | * - $_dependency_map |
||
1060 | * - $_class_abbreviations |
||
1061 | * - $NET_CFG (EE_Network_Config): The config is shared network wide so no need to reset. |
||
1062 | * - $REQ: Still on the same request so no need to change. |
||
1063 | * - $CAP: There is no site specific state in the EE_Capability class. |
||
1064 | * - $SSN: Although ideally, the session should not be shared between site switches, we can't reset it because only one Session |
||
1065 | * can be active in a single request. Resetting could resolve in "headers already sent" errors. |
||
1066 | * - $addons: In multisite, the state of the addons is something controlled via hooks etc in a normal request. So |
||
1067 | * for now, we won't reset the addons because it could break calls to an add-ons class/methods in the |
||
1068 | * switch or on the restore. |
||
1069 | * - $modules |
||
1070 | * - $shortcodes |
||
1071 | * - $widgets |
||
1072 | * - $LIB: Only specific classes get unset from $LIB (current EE_Data_Migration_Manager) that persist state. |
||
1073 | * |
||
1074 | * @param boolean $hard whether to reset data in the database too, or just refresh |
||
1075 | * the Registry to its state at the beginning of the request |
||
1076 | * @param boolean $reinstantiate whether to create new instances of EE_Registry's singletons too, |
||
1077 | * or just reset without re-instantiating (handy to set to FALSE if you're not sure if you CAN |
||
1078 | * currently reinstantiate the singletons at the moment) |
||
1079 | * @param bool $reset_models Defaults to true. When false, then the models are not reset. This is so client |
||
1080 | * code instead can just change the model context to a different blog id if necessary |
||
1081 | * |
||
1082 | * @return EE_Registry |
||
1083 | */ |
||
1084 | public static function reset( $hard = false, $reinstantiate = true, $reset_models = true ) { |
||
1109 | |||
1110 | |||
1111 | |||
1112 | |||
1113 | /** |
||
1114 | * Returns a filtered array of classes to unset from the $LIB property when EE_Registry::reset is called. |
||
1115 | * @return array |
||
1116 | */ |
||
1117 | protected function _classes_to_unset_from_LIB_on_reset() { |
||
1124 | |||
1125 | |||
1126 | |||
1127 | /** |
||
1128 | * @override magic methods |
||
1129 | * @return void |
||
1130 | */ |
||
1131 | final function __destruct() { |
||
1133 | |||
1134 | |||
1135 | |||
1136 | /** |
||
1137 | * @param $a |
||
1138 | * @param $b |
||
1139 | */ |
||
1140 | final function __call( $a, $b ) { |
||
1142 | |||
1143 | |||
1144 | |||
1145 | /** |
||
1146 | * @param $a |
||
1147 | */ |
||
1148 | final function __get( $a ) { |
||
1150 | |||
1151 | |||
1152 | |||
1153 | /** |
||
1154 | * @param $a |
||
1155 | * @param $b |
||
1156 | */ |
||
1157 | final function __set( $a, $b ) { |
||
1159 | |||
1160 | |||
1161 | |||
1162 | /** |
||
1163 | * @param $a |
||
1164 | */ |
||
1165 | final function __isset( $a ) { |
||
1167 | |||
1168 | |||
1169 | |||
1170 | /** |
||
1171 | * @param $a |
||
1172 | */ |
||
1173 | final function __unset( $a ) { |
||
1175 | |||
1176 | |||
1177 | |||
1178 | /** |
||
1179 | * @return array |
||
1180 | */ |
||
1181 | final function __sleep() { |
||
1184 | |||
1185 | |||
1186 | |||
1187 | final function __wakeup() { |
||
1189 | |||
1190 | |||
1191 | |||
1192 | /** |
||
1193 | * @return string |
||
1194 | */ |
||
1195 | final function __toString() { |
||
1198 | |||
1199 | |||
1200 | |||
1201 | final function __invoke() { |
||
1203 | |||
1204 | |||
1205 | |||
1206 | final function __set_state() { |
||
1208 | |||
1209 | |||
1210 | |||
1211 | final function __clone() { |
||
1213 | |||
1214 | |||
1215 | |||
1216 | /** |
||
1217 | * @param $a |
||
1218 | * @param $b |
||
1219 | */ |
||
1220 | final static function __callStatic( $a, $b ) { |
||
1222 | |||
1223 | /** |
||
1224 | * Gets all the custom post type models defined |
||
1225 | * @return array keys are model "short names" (Eg "Event") and keys are classnames (eg "EEM_Event") |
||
1226 | */ |
||
1227 | public function cpt_models() { |
||
1236 | |||
1237 | |||
1238 | |||
1239 | public static function CFG() { |
||
1242 | |||
1243 | |||
1244 | } |
||
1245 | // End of file EE_Registry.core.php |
||
1247 |
It seems like you allow that null is being passed for a parameter, however the function which is called does not seem to accept null.
We recommend to add an additional type check (or disallow null for the parameter):