AnonymousReporter::init()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Peridot\Reporter;
3
4
use Evenement\EventEmitterInterface;
5
use Peridot\Configuration;
6
use Symfony\Component\Console\Output\OutputInterface;
7
8
/**
9
 * The AnonymousReporter creates a reporter from a PHP callable.
10
 *
11
 * @package Peridot\Reporter
12
 */
13
class AnonymousReporter extends AbstractBaseReporter
14
{
15
    /**
16
     * @var callable
17
     */
18
    protected $initFn;
19
20
    /**
21
     * Creates a reporter from a callable
22
     *
23
     * @param callable $init
24
     * @param Configuration $configuration
25
     * @param OutputInterface $output
26
     * @param EventEmitterInterface $eventEmitter
27
     */
28
    public function __construct(
29
        callable $init,
30
        Configuration $configuration,
31
        OutputInterface $output,
32
        EventEmitterInterface $eventEmitter
33
    ) {
34
        $this->initFn = $init;
35
        parent::__construct($configuration, $output, $eventEmitter);
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     *
41
     * @return void
42
     */
43
    public function init()
44
    {
45
        call_user_func($this->initFn, $this);
46
    }
47
}
48