Passed
Push — master ( 43534e...6dc374 )
by Alex
01:15 queued 12s
created

LazyListenerMock   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 5
c 0
b 0
f 0
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __invoke() 0 4 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ArpTest\EventDispatcher\Listener;
6
7
use PHPUnit\Framework\Assert;
8
9
/**
10
 * Test listener class that we can get the LazyListener to create within our testing.
11
 *
12
 * @author  Alex Patterson <[email protected]>
13
 * @package ArpTest\EventDispatcher\Listener
14
 */
15
final class LazyListenerMock
16
{
17
    /**
18
     * @var array
19
     */
20
    private $arguments;
21
22
    /**
23
     * @param array $arguments
24
     */
25
    public function __construct(array $arguments = [])
26
    {
27
        $this->arguments = $arguments;
28
    }
29
30
    /**
31
     * __invoke
32
     *
33
     * @param object $event
34
     */
35
    public function __invoke(object $event)
36
    {
37
        if (isset($this->arguments[0]) && is_object($this->arguments[0])) {
38
            Assert::assertSame($this->arguments[0], $event);
39
        }
40
    }
41
}
42