Conditions | 9 |
Paths | 12 |
Total Lines | 28 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | public function isCompatible(AssociationStubBase $otherStub) |
||
13 | { |
||
14 | if (!parent::isCompatible($otherStub)) { |
||
15 | return false; |
||
16 | } |
||
17 | $isNull = null == $this->getThroughField(); |
||
18 | $otherNull = null == $otherStub->getThroughField(); |
||
19 | |||
20 | if ($isNull != $otherNull) { |
||
21 | return false; |
||
22 | } |
||
23 | $thisChain = $this->getThroughFieldChain(); |
||
24 | $otherChain = $otherStub->getThroughFieldChain(); |
||
25 | $thisThroughCount = count($thisChain) - 1; |
||
26 | $otherThroughCount = count($otherChain) - 1; |
||
27 | if ($thisThroughCount !== $otherThroughCount) { |
||
28 | return false; |
||
29 | } |
||
30 | for($i=0; $i <= $thisThroughCount;++$i ){ |
||
31 | if($thisChain[$i] !== $otherChain[$otherThroughCount -$i]){ |
||
32 | return false; |
||
33 | } |
||
34 | } |
||
35 | |||
36 | return ($this->getTargType() === $otherStub->getBaseType()) |
||
37 | && ($this->getBaseType() === $otherStub->getTargType()) |
||
38 | && ($this->getForeignField() === $otherStub->getKeyField()) |
||
39 | && ($this->getKeyField() === $otherStub->getForeignField()); |
||
40 | } |
||
50 |