| Conditions | 11 |
| Paths | 9 |
| Total Lines | 36 |
| Code Lines | 18 |
| 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 |
||
| 84 | public function equals(Attachment $attachment) |
||
| 85 | { |
||
| 86 | if ($this->usageType !== $attachment->usageType) { |
||
| 87 | return false; |
||
| 88 | } |
||
| 89 | |||
| 90 | if ($this->contentType !== $attachment->contentType) { |
||
| 91 | return false; |
||
| 92 | } |
||
| 93 | |||
| 94 | if ($this->length !== $attachment->length) { |
||
| 95 | return false; |
||
| 96 | } |
||
| 97 | |||
| 98 | if ($this->sha2 !== $attachment->sha2) { |
||
| 99 | return false; |
||
| 100 | } |
||
| 101 | |||
| 102 | if (!$this->display->equals($attachment->display)) { |
||
| 103 | return false; |
||
| 104 | } |
||
| 105 | |||
| 106 | if (null !== $this->description xor null !== $attachment->description) { |
||
| 107 | return false; |
||
| 108 | } |
||
| 109 | |||
| 110 | if (null !== $this->description && null !== $attachment->description && !$this->description->equals($attachment->description)) { |
||
| 111 | return false; |
||
| 112 | } |
||
| 113 | |||
| 114 | if ($this->fileUrl !== $attachment->fileUrl) { |
||
| 115 | return false; |
||
| 116 | } |
||
| 117 | |||
| 118 | return true; |
||
| 119 | } |
||
| 120 | } |
||
| 121 |