Conditions | 6 |
Paths | 4 |
Total Lines | 31 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 42 |
Changes | 0 |
1 | <?php |
||
40 | public function run( |
||
41 | string $field, |
||
42 | string $source, |
||
43 | string $target, |
||
44 | int $siteId = null |
||
45 | ) { |
||
46 | |||
47 | // Resolve |
||
48 | $field = $this->resolveField($field); |
||
49 | $source = $this->resolveElement($source); |
||
50 | $target = $this->resolveElement($target); |
||
51 | |||
52 | /** @var Field $field */ |
||
53 | |||
54 | $siteId = $this->resolveSiteId($siteId ?: $source->siteId); |
||
55 | |||
56 | $query = Association::find() |
||
57 | ->fieldId($field->id) |
||
58 | ->sourceId($source->getId() ?: false) |
||
59 | ->targetId($target->getId() ?: false); |
||
60 | |||
61 | if ($siteId) { |
||
|
|||
62 | $query->siteId($siteId); |
||
63 | } |
||
64 | |||
65 | if (!$record = $query->one()) { |
||
66 | return true; |
||
67 | } |
||
68 | |||
69 | return $this->runInternal($record); |
||
70 | } |
||
71 | |||
83 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: