Conditions | 2 |
Paths | 2 |
Total Lines | 54 |
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\GeneralSettings', |
||
33 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\Locale', |
||
34 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteUrls', |
||
35 | ]; |
||
36 | foreach ($basic_nodes as $basic_node) { |
||
37 | $this->dependency_map->registerDependencies( |
||
38 | $basic_node, |
||
39 | ['EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache] |
||
40 | ); |
||
41 | } |
||
42 | $this->dependency_map->registerDependencies( |
||
43 | 'EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData', |
||
44 | [ |
||
45 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\Api' => EE_Dependency_Map::load_from_cache, |
||
46 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\Config' => EE_Dependency_Map::load_from_cache, |
||
47 | 'EventEspresso\core\services\assets\JedLocaleData' => EE_Dependency_Map::load_from_cache, |
||
48 | 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
||
49 | ] |
||
50 | ); |
||
51 | $this->dependency_map->registerDependencies( |
||
52 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\Config', |
||
53 | [ |
||
54 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\CurrentUser' => EE_Dependency_Map::load_from_cache, |
||
55 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\EspressoCoreDomain' => EE_Dependency_Map::load_from_cache, |
||
56 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\GeneralSettings' => EE_Dependency_Map::load_from_cache, |
||
57 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\Locale' => EE_Dependency_Map::load_from_cache, |
||
58 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteCurrency' => EE_Dependency_Map::load_from_cache, |
||
59 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteUrls' => EE_Dependency_Map::load_from_cache, |
||
60 | 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
||
61 | ] |
||
62 | ); |
||
63 | $this->dependency_map->registerDependencies( |
||
64 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\EspressoCoreDomain', |
||
65 | [ |
||
66 | 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
||
67 | 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
||
68 | ] |
||
69 | ); |
||
70 | $this->dependency_map->registerDependencies( |
||
71 | 'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteCurrency', |
||
72 | [ |
||
73 | 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
||
74 | 'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache, |
||
75 | ] |
||
76 | ); |
||
77 | $this->setDataNode( |
||
78 | $this->loader->getShared('EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData') |
||
79 | ); |
||
80 | } |
||
81 | |||
140 |