GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Collection::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 11
nc 1
nop 11
dl 0
loc 26
rs 9.9
c 0
b 0
f 0

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
declare(strict_types=1);
3
/**
4
 */
5
6
namespace CommerceLeague\ActiveCampaign\Model\ResourceModel\ActiveCampaign\Order\Grid;
7
8
use CommerceLeague\ActiveCampaign\Model\ResourceModel\ActiveCampaign\Order\Collection as ExtendCollection;
9
use Magento\Framework\Api\Search\AggregationInterface;
10
use Magento\Framework\Api\Search\SearchResultInterface;
11
use Magento\Framework\Api\SearchCriteriaInterface;
12
use Magento\Framework\Data\Collection\Db\FetchStrategyInterface;
13
use Magento\Framework\Data\Collection\EntityFactoryInterface;
14
use Magento\Framework\DB\Adapter\AdapterInterface;
15
use Magento\Framework\Event\ManagerInterface;
16
use Magento\Framework\Model\ResourceModel\Db\AbstractDb;
17
use Magento\Framework\View\Element\UiComponent\DataProvider\Document;
18
use Psr\Log\LoggerInterface;
19
20
/**
21
 * Class Collection
22
 * @codeCoverageIgnore
23
 */
24
class Collection extends ExtendCollection implements SearchResultInterface
25
{
26
    /**
27
     * @var AggregationInterface
28
     */
29
    private $aggregations;
30
31
    /**
32
     * @param EntityFactoryInterface $entityFactory
33
     * @param LoggerInterface $logger
34
     * @param FetchStrategyInterface $fetchStrategy
35
     * @param ManagerInterface $eventManager
36
     * @param string $mainTable
37
     * @param string $eventPrefix
38
     * @param string $eventObject
39
     * @param string $resourceModel
40
     * @param string $model
41
     * @param AdapterInterface|null $connection
42
     * @param AbstractDb|null $resource
43
     */
44
    public function __construct(
45
        EntityFactoryInterface $entityFactory,
46
        LoggerInterface $logger,
47
        FetchStrategyInterface $fetchStrategy,
48
        ManagerInterface $eventManager,
49
        string $mainTable,
50
        string $eventPrefix,
51
        string $eventObject,
52
        string $resourceModel,
53
        string $model = Document::class,
54
        AdapterInterface $connection = null,
55
        AbstractDb $resource = null
56
    ) {
57
        parent::__construct(
58
            $entityFactory,
59
            $logger,
60
            $fetchStrategy,
61
            $eventManager,
62
            $connection,
63
            $resource
64
        );
65
66
        $this->_eventPrefix = $eventPrefix;
67
        $this->_eventObject = $eventObject;
68
        $this->_init($model, $resourceModel);
69
        $this->setMainTable($mainTable);
70
    }
71
72
    /**
73
     * @inheritDoc
74
     */
75
    public function setItems(array $items = null)
76
    {
77
        return $this;
78
    }
79
80
    /**
81
     * @inheritDoc
82
     */
83
    public function getAggregations()
84
    {
85
        return $this->aggregations;
86
    }
87
88
    /**
89
     * @inheritDoc
90
     */
91
    public function setAggregations($aggregations)
92
    {
93
        $this->aggregations = $aggregations;
94
        return $this;
95
    }
96
97
    /**
98
     * @inheritDoc
99
     */
100
    public function getSearchCriteria()
101
    {
102
        return null;
103
    }
104
105
    /**
106
     * @inheritDoc
107
     */
108
    public function setSearchCriteria(SearchCriteriaInterface $searchCriteria = null)
109
    {
110
        return $this;
111
    }
112
113
    /**
114
     * @inheritDoc
115
     */
116
    public function getTotalCount()
117
    {
118
        return $this->getSize();
119
    }
120
121
    /**
122
     * @inheritDoc
123
     */
124
    public function setTotalCount($totalCount)
125
    {
126
        return $this;
127
    }
128
}
129