Query::all()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
4
namespace carono\yii2trello\query;
5
6
7
use Trello\Client;
0 ignored issues
show
Bug introduced by
The type Trello\Client was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use yii2mod\query\ArrayQuery;
9
10
abstract class Query extends ArrayQuery
11
{
12
    protected $modelClass;
13
    protected $client;
14
    protected $member;
15
16
    /**
17
     * @param $id
18
     * @return $this
19
     */
20
    public function andWhereMember($id)
21
    {
22
        $this->member = $id;
23
        return $this;
24
    }
25
26
    public function __construct($modelClass, $config = [])
27
    {
28
        $this->modelClass = $modelClass;
29
        parent::__construct($config);
30
    }
31
32
    /**
33
     * @param null $client
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $client is correct as it would always require null to be passed?
Loading history...
34
     * @return array
35
     */
36
    public function all($client = null): array
37
    {
38
        $this->client = static::getClient($client);
39
        return parent::all();
40
    }
41
42
    public function one($client = null)
43
    {
44
        $this->client = static::getClient($client);
45
        return parent::one();
46
    }
47
48
    /**
49
     * @param null $client
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $client is correct as it would always require null to be passed?
Loading history...
50
     * @return Client
51
     */
52
    protected static function getClient($client = null)
53
    {
54
        if ($client === null) {
0 ignored issues
show
introduced by
The condition $client === null is always true.
Loading history...
55
            $client = \Yii::$app->get('trello');
56
        }
57
        return $client;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $client also could return the type mixed which is incompatible with the documented return type Trello\Client.
Loading history...
58
    }
59
60
    /**
61
     * @param $client
62
     * @return \Trello\Model\Member
63
     */
64
    protected function getMember($client)
65
    {
66
        $member = new \Trello\Model\Member(static::getClient($client));
0 ignored issues
show
Bug introduced by
The type Trello\Model\Member was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
67
        $member->setId($this->member);
68
        return $member;
69
    }
70
}