ConsoleProgressWriter   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 4
c 2
b 1
f 0
lcom 1
cbo 1
dl 0
loc 41
ccs 9
cts 9
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A writeItem() 0 4 1
A prepare() 0 4 1
A finish() 0 4 1
1
<?php
2
3
/**
4
 * This file is part of plumphp/plum-console.
5
 *
6
 * (c) Florian Eckerstorfer <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Plum\PlumConsole;
13
14
use Plum\Plum\Writer\WriterInterface;
15
use Symfony\Component\Console\Helper\ProgressBar;
16
17
/**
18
 * ConsoleProgressWriter.
19
 *
20
 * @author    Florian Eckerstorfer <[email protected]>
21
 * @copyright 2014-2015 Florian Eckerstorfer
22
 */
23
class ConsoleProgressWriter implements WriterInterface
24
{
25
    /** @var ProgressBar */
26
    protected $progressBar;
27
28
    /**
29
     * @param ProgressBar $progressBar
30
     *
31
     * @codeCoverageIgnore
32
     */
33
    public function __construct(ProgressBar $progressBar)
34
    {
35
        $this->progressBar = $progressBar;
36
    }
37
38
    /**
39
     * Write the given item.
40
     *
41
     * @param mixed $item
42
     */
43 1
    public function writeItem($item)
44
    {
45 1
        $this->progressBar->advance();
46 1
    }
47
48
    /**
49
     * Prepare the writer.
50
     */
51 1
    public function prepare()
52
    {
53 1
        $this->progressBar->start();
54 1
    }
55
56
    /**
57
     * Finish the writer.
58
     */
59 1
    public function finish()
60
    {
61 1
        $this->progressBar->finish();
62 1
    }
63
}
64