Conditions | 2 |
Paths | 2 |
Total Lines | 60 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
27 | public function initialize() |
||
28 | { |
||
29 | $basic_nodes = [ |
||
30 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\Api', |
||
31 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\CurrentUser', |
||
32 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\Locale', |
||
33 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteUrls', |
||
34 | ]; |
||
35 | foreach ($basic_nodes as $basic_node) { |
||
36 | $this->dependency_map->registerDependencies( |
||
37 | $basic_node, |
||
38 | ['EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache] |
||
39 | ); |
||
40 | } |
||
41 | $this->dependency_map->registerDependencies( |
||
42 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\GeneralSettings', |
||
43 | [ |
||
44 | 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
||
45 | 'EventEspresso\core\services\converters\date_time_formats\PhpToUnicode' => EE_Dependency_Map::load_from_cache, |
||
46 | ] |
||
47 | ); |
||
48 | $this->dependency_map->registerDependencies( |
||
49 | 'EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData', |
||
50 | [ |
||
51 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\Api' => EE_Dependency_Map::load_from_cache, |
||
52 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\Config' => EE_Dependency_Map::load_from_cache, |
||
53 | 'EventEspresso\core\services\assets\JedLocaleData' => EE_Dependency_Map::load_from_cache, |
||
54 | 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
||
55 | ] |
||
56 | ); |
||
57 | $this->dependency_map->registerDependencies( |
||
58 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\Config', |
||
59 | [ |
||
60 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\CurrentUser' => EE_Dependency_Map::load_from_cache, |
||
61 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\EspressoCoreDomain' => EE_Dependency_Map::load_from_cache, |
||
62 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\GeneralSettings' => EE_Dependency_Map::load_from_cache, |
||
63 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\Locale' => EE_Dependency_Map::load_from_cache, |
||
64 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteCurrency' => EE_Dependency_Map::load_from_cache, |
||
65 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteUrls' => EE_Dependency_Map::load_from_cache, |
||
66 | 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
||
67 | ] |
||
68 | ); |
||
69 | $this->dependency_map->registerDependencies( |
||
70 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\EspressoCoreDomain', |
||
71 | [ |
||
72 | 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
||
73 | 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
||
74 | ] |
||
75 | ); |
||
76 | $this->dependency_map->registerDependencies( |
||
77 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteCurrency', |
||
78 | [ |
||
79 | 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
||
80 | 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
||
81 | ] |
||
82 | ); |
||
83 | $this->setDataNode( |
||
84 | $this->loader->getShared('EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData') |
||
85 | ); |
||
86 | } |
||
87 | |||
146 |