ConfigureIO::of()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
/**
4
 * This file is part of Collision.
5
 *
6
 * (c) Nuno Maduro <[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 NunoMaduro\Collision\Adapters\Phpunit;
13
14
use ReflectionObject;
15
use Symfony\Component\Console\Application;
16
use Symfony\Component\Console\Input\InputInterface;
17
use Symfony\Component\Console\Output\Output;
18
19
/**
20
 * @internal
21
 */
22
final class ConfigureIO
23
{
24
    /**
25
     * Configures both given input and output with
26
     * options from the enviroment.
27
     *
28
     * @throws \ReflectionException
29
     */
30 3
    public static function of(InputInterface $input, Output $output): void
31
    {
32 3
        $application = new Application();
33 3
        $reflector   = new ReflectionObject($application);
34 3
        $method      = $reflector->getMethod('configureIO');
35 3
        $method->setAccessible(true);
36 3
        $method->invoke($application, $input, $output);
37 3
    }
38
}
39