Conditions | 17 |
Paths | > 20000 |
Total Lines | 53 |
Code Lines | 34 |
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 |
||
94 | public function normalize($object, $format = null, array $context = []) |
||
95 | { |
||
96 | $data = new \stdClass(); |
||
97 | if (null !== $object->getCiBuildConfigurationName()) { |
||
98 | $data->{'CiBuildConfigurationName'} = $object->getCiBuildConfigurationName(); |
||
99 | } |
||
100 | if (null !== $object->getCiBuildHasChange()) { |
||
101 | $data->{'CiBuildHasChange'} = $object->getCiBuildHasChange(); |
||
102 | } |
||
103 | if (null !== $object->getCiBuildId()) { |
||
104 | $data->{'CiBuildId'} = $object->getCiBuildId(); |
||
105 | } |
||
106 | if (null !== $object->getCiBuildServerName()) { |
||
107 | $data->{'CiBuildServerName'} = $object->getCiBuildServerName(); |
||
108 | } |
||
109 | if (null !== $object->getCiBuildServerVersion()) { |
||
110 | $data->{'CiBuildServerVersion'} = $object->getCiBuildServerVersion(); |
||
111 | } |
||
112 | if (null !== $object->getCiBuildUrl()) { |
||
113 | $data->{'CiBuildUrl'} = $object->getCiBuildUrl(); |
||
114 | } |
||
115 | if (null !== $object->getCiNcPluginVersion()) { |
||
116 | $data->{'CiNcPluginVersion'} = $object->getCiNcPluginVersion(); |
||
117 | } |
||
118 | if (null !== $object->getCiTimestamp()) { |
||
119 | $data->{'CiTimestamp'} = $object->getCiTimestamp()->format("Y-m-d\TH:i:sP"); |
||
120 | } |
||
121 | if (null !== $object->getComitterId()) { |
||
122 | $data->{'ComitterId'} = $object->getComitterId(); |
||
123 | } |
||
124 | if (null !== $object->getCommitter()) { |
||
125 | $data->{'Committer'} = $object->getCommitter(); |
||
126 | } |
||
127 | if (null !== $object->getCommitterName()) { |
||
128 | $data->{'CommitterName'} = $object->getCommitterName(); |
||
129 | } |
||
130 | if (null !== $object->getCommitterOverride()) { |
||
131 | $data->{'CommitterOverride'} = $object->getCommitterOverride(); |
||
132 | } |
||
133 | if (null !== $object->getIntegrationSystem()) { |
||
134 | $data->{'IntegrationSystem'} = $object->getIntegrationSystem(); |
||
135 | } |
||
136 | if (null !== $object->getIsCommiterExistAndAuthorizedInNc()) { |
||
137 | $data->{'IsCommiterExistAndAuthorizedInNc'} = $object->getIsCommiterExistAndAuthorizedInNc(); |
||
138 | } |
||
139 | if (null !== $object->getVcsName()) { |
||
140 | $data->{'VcsName'} = $object->getVcsName(); |
||
141 | } |
||
142 | if (null !== $object->getVcsVersion()) { |
||
143 | $data->{'VcsVersion'} = $object->getVcsVersion(); |
||
144 | } |
||
145 | |||
146 | return $data; |
||
147 | } |
||
149 |