Passed
Branch development (bc47df)
by Theodoros
05:07
created

ProgressBarHelper::startProgressBar()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 3
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
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\Output\OutputInterface;
12
13
class ProgressBarHelper implements ProgressBarHelperInterface
14
{
15
16
    /** @var \Symfony\Component\Console\Helper\ProgressBar */
17
    protected $progressBar;
18
19
    /**
20
     * @param \Symfony\Component\Console\Output\OutputInterface $output
21
     * @param string $resourceType
22
     * @param int $totalCount
23
     *
24
     * @return \Symfony\Component\Console\Helper\ProgressBar
25
     */
26
    public function startProgressBar(
27
        OutputInterface $output,
28
        $resourceType,
29
        $totalCount
30
    ) {
31
        $this->progressBar = $this->generateProgressBar($output, $totalCount, $resourceType);
32
        $this->progressBar->start();
33
        $this->progressBar->advance(0);
34
35
        return $this->progressBar;
36
    }
37
38
    /**
39
     * @param \Symfony\Component\Console\Output\OutputInterface $output
40
     * @param int $count
41
     * @param string $resourceType
42
     *
43
     * @return \Symfony\Component\Console\Helper\ProgressBar
44
     */
45
    protected function generateProgressBar(OutputInterface $output, $count, $resourceType)
46
    {
47
        $builder = new ProgressBarBuilder($output, $count, $resourceType);
48
        return $builder->build();
49
    }
50
51
}
52