InlineProgressPanel   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 27
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setData() 0 4 1
1
<?php
2
3
  namespace Funivan\Console\ProgressPanel;
4
5
  use Symfony\Component\Console\Output\NullOutput;
6
  use Symfony\Component\Console\Output\OutputInterface;
7
8
  /**
9
   * If you invoke setData($message) $message will be displayed
10
   *  Otherwise all data will be sent to NullOutput
11
   *
12
   * @author Ivan Shcherbak <[email protected]>
13
   */
14
  class InlineProgressPanel extends ProgressPanel {
15
16
    /**
17
     * @var OutputInterface
18
     */
19
    private $realOutput;
20
21
22
    /**
23
     * @inheritdoc
24
     */
25
    public function __construct(OutputInterface $output, $max) {
26
      $this->realOutput = $output;
27
      parent::__construct(new NullOutput(), $max);
28
    }
29
30
31
    /**
32
     * @inheritdoc
33
     */
34
    public function setData($data) {
35
      $this->realOutput->writeln($data);
36
      return $this;
37
    }
38
39
40
  }