Conditions | 31 |
Paths | > 20000 |
Total Lines | 31 |
Code Lines | 22 |
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 |
||
77 | public function equals(?ValueObject $object) : bool |
||
78 | { |
||
79 | if (!$object instanceof self) { |
||
80 | return false; |
||
81 | } |
||
82 | |||
83 | return ( |
||
84 | ( |
||
85 | (null === $this->getStreet() && null === $object->getStreet()) || |
||
86 | (\is_object($this->getStreet()) && $this->getStreet()->equals($object->getStreet())) || |
||
87 | (\is_object($object->getStreet()) && $object->getStreet()->equals($this->getStreet())) |
||
88 | ) && |
||
89 | ( |
||
90 | (null === $this->getCity() && null === $object->getCity()) || |
||
91 | (\is_object($this->getCity()) && $this->getCity()->equals($object->getCity())) || |
||
92 | (\is_object($object->getCity()) && $object->getCity()->equals($this->getCity())) |
||
93 | ) && |
||
94 | ( |
||
95 | (null === $this->getRegion() && null === $object->getRegion()) || |
||
96 | (\is_object($this->getRegion()) && $this->getRegion()->equals($object->getRegion())) || |
||
97 | (\is_object($object->getRegion()) && $object->getRegion()->equals($this->getRegion())) |
||
98 | ) && |
||
99 | ( |
||
100 | (null === $this->getPostalCode() && null === $object->getPostalCode()) || |
||
101 | (\is_object($this->getPostalCode()) && $this->getPostalCode()->equals($object->getPostalCode())) || |
||
102 | (\is_object($object->getPostalCode()) && $object->getPostalCode()->equals($this->getPostalCode())) |
||
103 | ) && |
||
104 | ( |
||
105 | (null === $this->getCountry() && null === $object->getCountry()) || |
||
106 | (\is_object($this->getCountry()) && $this->getCountry()->equals($object->getCountry())) || |
||
107 | (\is_object($object->getCountry()) && $object->getCountry()->equals($this->getCountry())) |
||
108 | ) |
||
142 |