ClientManager   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 0

Test Coverage

Coverage 100%
Metric Value
wmc 3
cbo 0
dl 0
loc 27
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getClient() 0 8 2
1
<?php
2
3
/*
4
 * This file is part of the xAPI package.
5
 *
6
 * (c) Christian Flothmann <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Xabbuh\XApi\Bundle\ClientBundle\Manager;
13
14
/**
15
 * XApiClient manager.
16
 *
17
 * @author Christian Flothmann <[email protected]>
18
 */
19
class ClientManager implements ClientManagerInterface
20
{
21
    /**
22
     * @var \Xabbuh\XApi\Client\XApiClientInterface[]
23
     */
24
    private $clients = array();
25
26
    /**
27
     * @param \Xabbuh\XApi\Client\XApiClientInterface[] $clients
28
     */
29 3
    public function __construct(array $clients)
30
    {
31 3
        $this->clients = $clients;
32 3
    }
33
34
    /**
35
     * {@inheritDoc}
36
     */
37 3
    public function getClient($name)
38
    {
39 3
        if (!isset($this->clients[$name])) {
40 2
            throw new \InvalidArgumentException('Client '.$name.' does not exist');
41
        }
42
43 1
        return $this->clients[$name];
44
    }
45
}
46