Completed
Pull Request — master (#15)
by Toan
05:34
created

ProgressBar   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getProgressBar() 0 4 1
A finish() 0 4 1
1
<?php
2
/**
3
 * Copyright © 2017 Toan Nguyen. All rights reserved.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace Gojira\Provider\Console;
10
11
use Gojira\Framework\App\Console\ProgressBarInterface;
12
use Symfony\Component\Console\Helper\ProgressBar as BaseProgressBar;
13
use Symfony\Component\Console\Output\OutputInterface;
14
15
/**
16
 * Base class for ProgressBar output render
17
 *
18
 * @codeCoverageIgnore
19
 * @package Gojira\Provider\Console
20
 * @author  Toan Nguyen <[email protected]>
21
 */
22
class ProgressBar implements ProgressBarInterface
23
{
24
    /**
25
     * @var \Symfony\Component\Console\Helper\ProgressBar
26
     */
27
    protected $progressBar = null;
28
29
    /**
30
     * ProgressBar constructor.
31
     *
32
     * @param OutputInterface $output   Console output
33
     * @param int             $maxSteps Maximum steps
34
     */
35
    public function __construct(OutputInterface $output, $maxSteps = 100)
36
    {
37
        $this->progressBar = new BaseProgressBar($output, $maxSteps);
38
        $this->progressBar->setFormat('minimal');
39
    }
40
41
    /**
42
     * @return \Symfony\Component\Console\Helper\ProgressBar
43
     */
44
    public function getProgressBar()
45
    {
46
        return $this->progressBar;
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function finish()
53
    {
54
        $this->progressBar->finish();
55
    }
56
}
57