Passed
Branch master (a96d1e)
by Nicolas
02:44
created

ConfigurationManager::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Cp\Manager;
4
5
use Cp\DomainObject\Configuration;
6
use Cp\Provider\TypeProvider;
7
8
/**
9
 * Class ConfigurationManager
10
 */
11
class ConfigurationManager
12
{
13
    /**
14
     * @var TypeProvider
15
     */
16
    private $typeProvider;
17
18
    /**
19
     * ConfigurationManager constructor.
20
     *
21
     * @param TypeProvider $typeProvider
22
     */
23 1
    public function __construct(TypeProvider $typeProvider)
24
    {
25 1
        $this->typeProvider = $typeProvider;
26 1
    }
27
28
    /**
29
     * @param string $typeName
30
     * @param int    $week
31
     * @param int    $seance
32
     *
33
     * @return Configuration
34
     */
35 1
    public function createConfiguration($typeName, $week, $seance)
36
    {
37 1
        $type = $this->typeProvider->getType($typeName);
38
39 1
        $configuration = new Configuration();
40 1
        $configuration->setType($type);
41 1
        $configuration->setNumberOfWeek($week);
42 1
        $configuration->setNumberOfSeance($seance);
43
44 1
        return $configuration;
45
    }
46
}
0 ignored issues
show
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
47