Test Failed
Pull Request — master (#33)
by Serhii
04:22 queued 46s
created

ProgressBarFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
eloc 10
c 2
b 0
f 0
dl 0
loc 26
ccs 0
cts 11
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A create() 0 11 1
1
<?php
2
3
namespace Matchish\ScoutElasticSearch\Console\Commands;
4
5
use Symfony\Component\Console\Style\OutputStyle;
6
7
class ProgressBarFactory
8
{
9
    /**
10
     * @var OutputStyle
11
     */
12
    private $output;
13
14
    /**
15
     * @param OutputStyle $output
16
     */
17
    public function __construct(OutputStyle $output)
18
    {
19
        $this->output = $output;
20
    }
21
22
    public function create(int $max = 0)
23
    {
24
        $bar = $this->output->createProgressBar($max);
25
        $bar->setBarCharacter('<fg=green>⚬</>');
26
        $bar->setEmptyBarCharacter('<fg=red>⚬</>');
27
        $bar->setProgressCharacter('<fg=green>➤</>');
28
        $bar->setFormat(
29
            "%message%\n%current%/%max% [%bar%] %percent:3s%%\n"
30
        );
31
32
        return $bar;
33
    }
34
}
35