CliParameterReader   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 25
c 0
b 0
f 0
wmc 3
lcom 1
cbo 2
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A read() 0 3 1
A has() 0 3 1
1
<?php
2
namespace rtens\domin\delivery\cli;
3
4
use rtens\domin\delivery\ParameterReader;
5
use rtens\domin\Parameter;
6
7
class CliParameterReader implements ParameterReader {
8
9
    /** @var Console */
10
    private $console;
11
12
    public function __construct(Console $console) {
13
        $this->console = $console;
14
    }
15
16
    /**
17
     * @param Parameter $parameter
18
     * @return mixed The serialized paramater
19
     */
20
    public function read(Parameter $parameter) {
21
        return $this->console->getOption($parameter->getName());
22
    }
23
24
    /**
25
     * @param Parameter $parameter
26
     * @return boolean
27
     */
28
    public function has(Parameter $parameter) {
29
        return $this->console->hasOption($parameter->getName());
30
    }
31
}