| Conditions | 37 |
| Paths | > 20000 |
| Total Lines | 48 |
| Code Lines | 38 |
| 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 |
||
| 117 | public function equals(?ValueObject $object) : bool |
||
| 118 | { |
||
| 119 | if (!$object instanceof self) { |
||
| 120 | return false; |
||
| 121 | } |
||
| 122 | |||
| 123 | return ( |
||
| 124 | ( |
||
| 125 | (null === $this->getStreet() && null === $object->getStreet()) || |
||
| 126 | (is_object($this->getStreet()) && $this->getStreet() |
||
| 127 | ->equals($object->getStreet())) || |
||
| 128 | (is_object($object->getStreet()) && $object->getStreet() |
||
| 129 | ->equals($this->getStreet())) |
||
| 130 | ) && |
||
| 131 | ( |
||
| 132 | (null === $this->getCity() && null === $object->getCity()) || |
||
| 133 | (is_object($this->getCity()) && $this->getCity() |
||
| 134 | ->equals($object->getCity())) || |
||
| 135 | (is_object($object->getCity()) && $object->getCity() |
||
| 136 | ->equals($this->getCity())) |
||
| 137 | ) && |
||
| 138 | ( |
||
| 139 | (null === $this->getCounty() && null === $object->getCounty()) || |
||
| 140 | (is_object($this->getCounty()) && $this->getCounty() |
||
| 141 | ->equals($object->getCounty())) || |
||
| 142 | (is_object($object->getCounty()) && $object->getCounty() |
||
| 143 | ->equals($this->getCounty())) |
||
| 144 | ) && |
||
| 145 | ( |
||
| 146 | (null === $this->getState() && null === $object->getState()) || |
||
| 147 | (is_object($this->getState()) && $this->getState() |
||
| 148 | ->equals($object->getState())) || |
||
| 149 | (is_object($object->getState()) && $object->getState() |
||
| 150 | ->equals($this->getState())) |
||
| 151 | ) && |
||
| 152 | ( |
||
| 153 | (null === $this->getZipCode() && null === $object->getZipCode()) || |
||
| 154 | (is_object($this->getZipCode()) && $this->getZipCode() |
||
| 155 | ->equals($object->getZipCode())) || |
||
| 156 | (is_object($object->getZipCode()) && $object->getZipCode() |
||
| 157 | ->equals($this->getZipCode())) |
||
| 158 | ) && |
||
| 159 | ( |
||
| 160 | (null === $this->getCountry() && null === $object->getCountry()) || |
||
| 161 | (is_object($this->getCountry()) && $this->getCountry() |
||
| 162 | ->equals($object->getCountry())) || |
||
| 163 | (is_object($object->getCountry()) && $object->getCountry() |
||
| 164 | ->equals($this->getCountry())) |
||
| 165 | ) |
||
| 203 |