1 | <?php |
||
2 | declare(strict_types=1); |
||
3 | /** |
||
4 | */ |
||
5 | |||
6 | namespace CommerceLeague\ActiveCampaign\Model\ResourceModel\Order; |
||
7 | |||
8 | use CommerceLeague\ActiveCampaign\Setup\SchemaInterface; |
||
9 | use Magento\Sales\Model\ResourceModel\Order\Collection as ExtendCollection; |
||
10 | |||
11 | /** |
||
12 | * Class Collection |
||
13 | * @codeCoverageIgnore |
||
14 | */ |
||
15 | class Collection extends ExtendCollection |
||
16 | { |
||
17 | /** |
||
18 | * @inheritDoc |
||
19 | */ |
||
20 | protected function _initSelect() |
||
21 | { |
||
22 | parent::_initSelect(); |
||
23 | |||
24 | $this->getSelect()->joinLeft( |
||
25 | ['ac_order' => $this->_resource->getTable(SchemaInterface::ORDER_TABLE)], |
||
0 ignored issues
–
show
|
|||
26 | 'ac_order.magento_quote_id = main_table.quote_id', |
||
27 | ['ac_order.activecampaign_id'] |
||
28 | ); |
||
29 | |||
30 | return $this; |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @return Collection |
||
35 | */ |
||
36 | public function addExcludeGuestFilter(): self |
||
37 | { |
||
38 | $this->getSelect()->where('main_table.customer_is_guest = 0'); |
||
39 | return $this; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @param int $orderId |
||
44 | * @return Collection |
||
45 | */ |
||
46 | public function addIdFilter(int $orderId): self |
||
47 | { |
||
48 | $this->getSelect()->where('main_table.entity_id = ?', $orderId); |
||
49 | return $this; |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * @return Collection |
||
54 | */ |
||
55 | public function addOmittedFilter(): self |
||
56 | { |
||
57 | $this->getSelect()->where('ac_order.activecampaign_id IS NULL'); |
||
58 | return $this; |
||
59 | } |
||
60 | } |
||
61 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.