Completed
Push — master ( 2b894b...836484 )
by Gaetano
05:34
created

ConsoleIO   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 28
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A onConsoleCommand() 0 4 1
A getInput() 0 4 1
A getOutput() 0 4 1
1
<?php
2
3
namespace Kaliop\eZMigrationBundle\Core\Helper;
4
5
use Symfony\Component\Console\Event\ConsoleCommandEvent;
6
7
/**
8
 * 'Saves' the console IO channels to make them available to whoever needs them, eg. kinky php migrations...
9
 */
10
class ConsoleIO
11
{
12
    protected $input;
13
    protected $output;
14
15
    public function onConsoleCommand(ConsoleCommandEvent $event) {
16
        $this->input = $event->getInput();
17
        $this->output = $event->getOutput();
18
    }
19
20
    /**
21
     * NB: will return NULL when called from anything else but a console application context!
22
     * @return \Symfony\Component\Console\Input\InputInterface
23
     */
24
    public function getInput()
25
    {
26
        return $this->input;
27
    }
28
29
    /**
30
     * NB: will return NULL when called from anything else but a console application context!
31
     * @return \Symfony\Component\Console\Output\OutputInterface
32
     */
33
    public function getOutput()
34
    {
35
        return $this->output;
36
    }
37
}
38