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

ProgressBarFactory::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 7
c 2
b 0
f 0
dl 0
loc 11
ccs 0
cts 8
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
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