BoardManager   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 5
c 2
b 0
f 1
lcom 1
cbo 3
dl 0
loc 41
ccs 12
cts 12
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getBoard() 0 16 4
1
<?php
2
3
namespace TrelloBurndown\Manager;
4
5
use TrelloBurndown\Client\TrelloClient;
6
use Trello\Manager;
7
8
/**
9
 * Class BoardManager.
10
 */
11
class BoardManager
12
{
13
    /**
14
     * @var \Trello\Client
15
     */
16
    protected $client;
17
18
    /**
19
     * BoardManager constructor.
20
     *
21
     * @param TrelloClient $trelloClient
22
     */
23 15
    public function __construct(TrelloClient $trelloClient)
24
    {
25 15
        $this->client = $trelloClient->getClient();
26 15
    }
27
28
    /**
29
     * Return in instance of Board get from the board name.
30
     *
31
     * @param string $boardName
32
     *
33
     * @return \Trello\Model\Board|null
34
     */
35 13
    public function getBoard(String $boardName)
36
    {
37 13
        $boards = $this->client->api('member')->boards()->all('me');
38 13
        foreach ($boards as $board) {
39 13
            if ($board['name'] == $boardName) {
40 13
                $boardId = $board['id'];
41
            }
42
        }
43
44 13
        $manager = new Manager($this->client);
45 13
        if (!isset($boardId)) {
46 3
            return;
47
        }
48
49 10
        return $manager->getBoard($boardId);
50
    }
51
}
52