Total Complexity | 8 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Changes | 4 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class AssociationStubMonomorphic extends AssociationStubBase |
||
8 | { |
||
9 | /** |
||
10 | * @param \AlgoWeb\PODataLaravel\Models\ObjectMap\Entities\Associations\AssociationStubBase $otherStub |
||
11 | * |
||
12 | * @return bool |
||
13 | */ |
||
14 | public function isCompatible(AssociationStubBase $otherStub): bool |
||
15 | { |
||
16 | if (!parent::isCompatible($otherStub)) { |
||
17 | return false; |
||
18 | } |
||
19 | |||
20 | if ($this->getThroughFieldChain() !== array_reverse($otherStub->getThroughFieldChain())) { |
||
21 | return false; |
||
22 | } |
||
23 | |||
24 | return ($this->getTargType() === $otherStub->getBaseType()) |
||
25 | && ($this->getBaseType() === $otherStub->getTargType()) |
||
26 | && ($this->getForeignFieldName() === $otherStub->getKeyFieldName()) |
||
27 | && ($this->getKeyFieldName() === $otherStub->getForeignFieldName()); |
||
28 | } |
||
29 | /** |
||
30 | * Is this AssociationStub sane? |
||
31 | */ |
||
32 | public function isOk(): bool |
||
40 | } |
||
41 | /** |
||
42 | * {@inheritdoc} |
||
43 | */ |
||
44 | public function morphicType(): string |
||
49 |