Conditions | 9 |
Paths | 6 |
Total Lines | 24 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 3 |
CRAP Score | 19.125 |
Changes | 0 |
1 | <?php |
||
49 | 1 | public function equals(StatementObject $object): bool |
|
50 | { |
||
51 | if (!$object instanceof Activity) { |
||
52 | return false; |
||
53 | } |
||
54 | |||
55 | if (!$this->id->equals($object->id)) { |
||
56 | return false; |
||
57 | } |
||
58 | |||
59 | if (null === $this->definition && null !== $object->definition) { |
||
60 | return false; |
||
61 | } |
||
62 | |||
63 | if (null !== $this->definition && null === $object->definition) { |
||
64 | return false; |
||
65 | 2 | } |
|
66 | |||
67 | 2 | if (null !== $this->definition && !$this->definition->equals($object->definition)) { |
|
|
|||
68 | return false; |
||
69 | } |
||
70 | |||
71 | return true; |
||
72 | } |
||
73 | } |
||
74 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: