Conditions | 12 |
Paths | 6 |
Total Lines | 28 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 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 declare(strict_types=1); |
||
35 | public function isCompatible(AssociationStubBase $otherStub) |
||
36 | { |
||
37 | if (!parent::isCompatible($otherStub)) { |
||
38 | return false; |
||
39 | } |
||
40 | $thisTarg = $this->getTargType(); |
||
41 | $thatTarg = $otherStub->getTargType(); |
||
42 | $thisNull = null === $thisTarg; |
||
43 | $thatNull = null === $thatTarg; |
||
44 | if ($thisNull == $thatNull && $thisNull) { |
||
45 | return false; |
||
46 | } |
||
47 | if ((!$thisNull && |
||
48 | !$thatNull) && |
||
49 | ($this->getBaseType() !== $otherStub->getTargType() || |
||
50 | $otherStub->getBaseType() !== $this->getTargType()) |
||
51 | ) { |
||
52 | return false; |
||
53 | } |
||
54 | |||
55 | if ($thisNull && ($thatTarg != $this->getBaseType())) { |
||
56 | return false; |
||
57 | } |
||
58 | if ($thatNull && ($thisTarg != $otherStub->getBaseType())) { |
||
59 | return false; |
||
60 | } |
||
61 | |||
62 | return true; |
||
63 | } |
||
85 |