Conditions | 10 |
Paths | 10 |
Total Lines | 14 |
Code Lines | 11 |
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 |
||
24 | public function same(AddressInterface $firstAddress, AddressInterface $secondAddress) |
||
25 | { |
||
26 | return self::normalize($firstAddress->getCity()) === self::normalize($secondAddress->getCity()) |
||
27 | && self::normalize($firstAddress->getStreet()) === self::normalize($secondAddress->getStreet()) |
||
28 | && self::normalize($firstAddress->getCompany()) === self::normalize($secondAddress->getCompany()) |
||
29 | && self::normalize($firstAddress->getPostcode()) === self::normalize($secondAddress->getPostcode()) |
||
30 | && self::normalize($firstAddress->getLastName()) === self::normalize($secondAddress->getLastName()) |
||
31 | && self::normalize($firstAddress->getFirstName()) === self::normalize($secondAddress->getFirstName()) |
||
32 | && self::normalize($firstAddress->getPhoneNumber()) === self::normalize($secondAddress->getPhoneNumber()) |
||
33 | && self::normalize($firstAddress->getCountryCode()) === self::normalize($secondAddress->getCountryCode()) |
||
34 | && self::normalize($firstAddress->getProvinceCode()) === self::normalize($secondAddress->getProvinceCode()) |
||
35 | && self::normalize($firstAddress->getProvinceName()) === self::normalize($secondAddress->getProvinceName()) |
||
36 | ; |
||
37 | } |
||
38 | |||
49 |