ProgressBarHelper::generateProgressBar()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 3
dl 0
loc 5
rs 10
1
<?php
2
3
/**
4
 * MIT License
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\Econda\Business\Helper;
9
10
use Spryker\Shared\Gui\ProgressBar\ProgressBarBuilder;
11
use Symfony\Component\Console\Helper\ProgressBar;
12
use Symfony\Component\Console\Output\OutputInterface;
13
14
class ProgressBarHelper implements ProgressBarHelperInterface
15
{
16
    /**
17
     * @var \Symfony\Component\Console\Helper\ProgressBar
18
     */
19
    protected $progressBar;
20
21
    /**
22
     * @param \Symfony\Component\Console\Output\OutputInterface $output
23
     * @param string $resourceType
24
     * @param int $totalCount
25
     *
26
     * @return \Symfony\Component\Console\Helper\ProgressBar
27
     */
28
    public function startProgressBar(
29
        OutputInterface $output,
30
        $resourceType,
31
        $totalCount
32
    ): ProgressBar {
33
        $this->progressBar = $this->generateProgressBar($output, $totalCount, $resourceType);
34
        $this->progressBar->start();
35
        $this->progressBar->advance(0);
36
37
        return $this->progressBar;
38
    }
39
40
    /**
41
     * @param \Symfony\Component\Console\Output\OutputInterface $output
42
     * @param int $count
43
     * @param string $resourceType
44
     *
45
     * @return \Symfony\Component\Console\Helper\ProgressBar
46
     */
47
    protected function generateProgressBar(OutputInterface $output, $count, $resourceType): ProgressBar
48
    {
49
        $builder = new ProgressBarBuilder($output, $count, $resourceType);
50
51
        return $builder->build();
52
    }
53
}
54