| Conditions | 22 |
| Paths | 14 |
| Total Lines | 56 |
| 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 |
||
| 148 | public function equals(Context $context): bool |
||
| 149 | { |
||
| 150 | if ($this->registration !== $context->registration) { |
||
| 151 | return false; |
||
| 152 | } |
||
| 153 | |||
| 154 | if (null !== $this->instructor xor null !== $context->instructor) { |
||
| 155 | return false; |
||
| 156 | } |
||
| 157 | |||
| 158 | if (null !== $this->instructor && null !== $context->instructor && !$this->instructor->equals($context->instructor)) { |
||
| 159 | return false; |
||
| 160 | } |
||
| 161 | |||
| 162 | if (null !== $this->team xor null !== $context->team) { |
||
| 163 | return false; |
||
| 164 | } |
||
| 165 | |||
| 166 | if (null !== $this->team && null !== $context->team && !$this->team->equals($context->team)) { |
||
| 167 | return false; |
||
| 168 | } |
||
| 169 | |||
| 170 | if ($this->contextActivities != $context->contextActivities) { |
||
| 171 | return false; |
||
| 172 | } |
||
| 173 | |||
| 174 | if ($this->revision !== $context->revision) { |
||
| 175 | return false; |
||
| 176 | } |
||
| 177 | |||
| 178 | if ($this->platform !== $context->platform) { |
||
| 179 | return false; |
||
| 180 | } |
||
| 181 | |||
| 182 | if ($this->language !== $context->language) { |
||
| 183 | return false; |
||
| 184 | } |
||
| 185 | |||
| 186 | if (null !== $this->statement xor null !== $context->statement) { |
||
| 187 | return false; |
||
| 188 | } |
||
| 189 | |||
| 190 | if (null !== $this->statement && null !== $context->statement && !$this->statement->equals($context->statement)) { |
||
| 191 | return false; |
||
| 192 | } |
||
| 193 | |||
| 194 | if (null !== $this->extensions xor null !== $context->extensions) { |
||
| 195 | return false; |
||
| 196 | } |
||
| 197 | |||
| 198 | if (null !== $this->extensions && null !== $context->extensions && !$this->extensions->equals($context->extensions)) { |
||
| 199 | return false; |
||
| 200 | } |
||
| 201 | |||
| 202 | return true; |
||
| 203 | } |
||
| 204 | } |
||
| 205 |