1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace TrelloCycleTime; |
6
|
|
|
|
7
|
|
|
use TrelloCycleTime\Client\TrelloApiClient; |
8
|
|
|
use TrelloCycleTime\Collection\CardsIdCollection; |
9
|
|
|
use TrelloCycleTime\Collection\HistoryCards; |
10
|
|
|
use TrelloCycleTime\Collection\TimeCards; |
11
|
|
|
|
12
|
|
|
final class TrelloBoard |
13
|
|
|
{ |
14
|
|
|
|
15
|
|
|
private $client; |
16
|
|
|
|
17
|
|
|
private $historyCardsCollection; |
18
|
|
|
|
19
|
|
|
private $timeCards; |
20
|
|
|
/** |
21
|
|
|
* @var string |
22
|
|
|
*/ |
23
|
|
|
private $boardId; |
24
|
|
|
/** |
25
|
|
|
* @var Filter |
26
|
|
|
*/ |
27
|
|
|
private $filter; |
28
|
|
|
|
29
|
3 |
|
public function __construct(TrelloApiClient $client, string $boardId) |
30
|
|
|
{ |
31
|
3 |
|
$this->client = $client; |
32
|
3 |
|
$this->timeCards = new TimeCards(); |
33
|
3 |
|
$this->boardId = $boardId; |
34
|
3 |
|
} |
35
|
|
|
|
36
|
2 |
|
public function getTransitions(array $filters = []) :array |
37
|
|
|
{ |
38
|
2 |
|
$this->filter = Filter::createFromArray($filters); |
39
|
2 |
|
$cards = CardsIdCollection::createFromArray($this->client->findAllCards($this->boardId)); |
40
|
|
|
|
41
|
2 |
|
$this->historyCardsCollection = HistoryCards::createFromCards($this->client, $cards->getCardsId(), $this->filter); |
42
|
|
|
|
43
|
2 |
|
return $this->calculateTimeCardsCycleTime(); |
44
|
|
|
} |
45
|
|
|
|
46
|
1 |
|
public function getCardTransitions(string $cardId, array $filters = []) :array |
47
|
|
|
{ |
48
|
1 |
|
$this->filter = Filter::createFromArray($filters); |
49
|
1 |
|
$cards = CardsIdCollection::createFromId($cardId); |
50
|
|
|
|
51
|
1 |
|
$this->historyCardsCollection = HistoryCards::createFromCards($this->client, $cards->getCardsId(), $this->filter); |
52
|
|
|
|
53
|
1 |
|
return $this->calculateTimeCardsCycleTime(); |
54
|
|
|
} |
55
|
|
|
|
56
|
3 |
|
private function calculateTimeCardsCycleTime() |
57
|
|
|
{ |
58
|
3 |
|
$timeCards = $this->timeCards->getFromHistoryCards($this->historyCardsCollection, $this->filter); |
|
|
|
|
59
|
|
|
|
60
|
3 |
|
$cycleTimeCalculator = new CycleTimeCalculator($timeCards, $this->historyCardsCollection); |
61
|
|
|
|
62
|
3 |
|
if ($this->filter->isFromColumnEnabled() && $this->filter->isToColumnEnabled()) { |
63
|
|
|
$cycleTimeCalculator->calculateWithStaticFromAndTo($this->filter->getFromColumn(), $this->filter->getToColumn()); |
64
|
|
|
} else { |
65
|
3 |
|
$cycleTimeCalculator->calculateFromCardHistory(); |
66
|
|
|
} |
67
|
|
|
|
68
|
3 |
|
return $cycleTimeCalculator->getTimeCards(); |
69
|
|
|
} |
70
|
|
|
} |
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.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.