TubeNameCheckingCommandLineCreator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 29
ccs 9
cts 9
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A setArguments() 0 8 1
1
<?php
2
3
4
namespace Beanie\Command\CommandLineCreator;
5
6
7
use Beanie\Exception\InvalidNameException;
8
use Beanie\Tube\ValidNameChecker;
9
10
class TubeNameCheckingCommandLineCreator extends GenericCommandLineCreator
11
{
12
    /**
13
     * @var ValidNameChecker
14
     */
15
    private $validNameChecker;
16
17
    /**
18
     * @inheritdoc
19
     */
20 16
    public function __construct($commandName, array $arguments, array $argumentDefaults = [])
21
    {
22 16
        $this->validNameChecker = new ValidNameChecker();
23 16
        parent::__construct($commandName, $arguments, $argumentDefaults);
24 16
    }
25
26
    /**
27
     * @param array $arguments
28
     * @throws InvalidNameException
29
     */
30 16
    protected function setArguments(array $arguments)
31
    {
32 16
        $tubeName = current($arguments);
33
34 16
        $this->validNameChecker->ensureValidName($tubeName);
35
36 16
        parent::setArguments($arguments);
37 16
    }
38
}
39