VerbosityString   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 33
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0
wmc 7
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
B __toString() 0 20 6
1
<?php declare(strict_types=1);
2
/* (c) Anton Medvedev <[email protected]>
3
 *
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 */
7
8
namespace Deployer\Console\Output;
9
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
class VerbosityString
13
{
14
    /**
15
     * @var OutputInterface
16
     */
17
    private $output;
18
19 10
    public function __construct(OutputInterface $output)
20
    {
21 10
        $this->output = $output;
22 10
    }
23
24 10
    public function __toString(): string
25
    {
26 10
        switch ($this->output->getVerbosity()) {
27 10
            case OutputInterface::VERBOSITY_VERBOSE:
28 1
                return '-v';
29
30 9
            case OutputInterface::VERBOSITY_VERY_VERBOSE:
31 1
                return '-vv';
32
33 8
            case OutputInterface::VERBOSITY_DEBUG:
34 4
                return '-vvv';
35
36 4
            case OutputInterface::VERBOSITY_QUIET:
37 1
                return '-q';
38
39 3
            case OutputInterface::VERBOSITY_NORMAL:
40
            default:
41 3
                return '';
42
        }
43
    }
44
}
45