Conditions | 1 |
Paths | 1 |
Total Lines | 65 |
Code Lines | 44 |
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 |
||
45 | public function denormalize(array $configuration) |
||
46 | { |
||
47 | return new Configuration( |
||
48 | $this->valueOrNull($configuration, ConfigurationNormalizer::KEY_NAME), |
||
49 | $this->valueOrNull($configuration, ConfigurationNormalizer::KEY_TYPE), |
||
50 | $this->valueOrNull($configuration, ConfigurationNormalizer::KEY_LICENSE), |
||
51 | $this->valueOrNull($configuration, ConfigurationNormalizer::KEY_VERSION), |
||
52 | $this->valueOrNull($configuration, ConfigurationNormalizer::KEY_DESCRIPTION), |
||
53 | $configuration[ConfigurationNormalizer::KEY_KEYWORDS], |
||
54 | $this->getNormalizedOrDefault( |
||
55 | $this->authorListNormalizer, |
||
56 | $configuration, |
||
57 | ConfigurationNormalizer::KEY_AUTHORS, |
||
58 | [] |
||
59 | ), |
||
60 | $this->getNormalizedOrDefault( |
||
61 | $this->packageListNormalizer, |
||
62 | $configuration, |
||
63 | ConfigurationNormalizer::KEY_PROVIDE, |
||
64 | [] |
||
65 | ), |
||
66 | $this->getNormalizedOrDefault( |
||
67 | $this->suggestedPackageListNormalizer, |
||
68 | $configuration, |
||
69 | ConfigurationNormalizer::KEY_SUGGEST, |
||
70 | [] |
||
71 | ), |
||
72 | $this->getNormalizedOrDefault( |
||
73 | $this->supportListNormalizer, |
||
74 | $configuration, |
||
75 | ConfigurationNormalizer::KEY_SUPPORT, |
||
76 | [] |
||
77 | ), |
||
78 | $this->getNormalizedOrDefault( |
||
79 | $this->autoloadListNormalizer, |
||
80 | $configuration, |
||
81 | ConfigurationNormalizer::KEY_AUTOLOAD, |
||
82 | [] |
||
83 | ), |
||
84 | $this->getNormalizedOrDefault( |
||
85 | $this->autoloadListNormalizer, |
||
86 | $configuration, |
||
87 | ConfigurationNormalizer::KEY_AUTOLOAD_DEV, |
||
88 | [] |
||
89 | ), |
||
90 | $this->getNormalizedOrDefault( |
||
91 | $this->packageListNormalizer, |
||
92 | $configuration, |
||
93 | ConfigurationNormalizer::KEY_REQUIRE, |
||
94 | [] |
||
95 | ), |
||
96 | $this->getNormalizedOrDefault( |
||
97 | $this->packageListNormalizer, |
||
98 | $configuration, |
||
99 | ConfigurationNormalizer::KEY_REQUIRE_DEV, |
||
100 | [] |
||
101 | ), |
||
102 | $this->getNormalizedOrDefault( |
||
103 | $this->scriptListNormalizer, |
||
104 | $configuration, |
||
105 | ConfigurationNormalizer::KEY_SCRIPT, |
||
106 | [] |
||
107 | ) |
||
108 | ); |
||
109 | } |
||
110 | |||
135 |