CardQuery   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fetchData() 0 9 2
A andWhereBoard() 0 4 1
1
<?php
2
3
4
namespace carono\yii2trello\query;
5
6
7
use carono\yii2trello\Board;
8
use Trello\Model\Card;
0 ignored issues
show
Bug introduced by
The type Trello\Model\Card 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...
9
10
/**
11
 * Class CardQuery
12
 *
13
 * @package carono\yii2trello\query
14
 * @method Card[] all($client = null) : array
15
 * @method null|Card one($client = null)
16
 */
17
class CardQuery extends Query
18
{
19
    protected $board;
20
21
    /**
22
     * @param $id
23
     * @return $this
24
     */
25
    public function andWhereBoard($id)
26
    {
27
        $this->board = $id;
28
        return $this;
29
    }
30
31
    protected function fetchData(): array
32
    {
33
        $boards = Board::find()->andWhereMember($this->member)->andFilterWhere(['id' => $this->board])->all($this->client);
34
        $cards = [];
35
        foreach ($boards as $board) {
36
            $cards[] = $board->getCards();
37
        }
38
        $this->from = array_merge(...$cards);
39
        return parent::fetchData();
40
    }
41
}