ClientManager::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
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