Test Failed
Pull Request — master (#10)
by Alice
01:55
created

TestListener::onTickRemoved()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Wonderland\Thread\Example\Simple;
4
5
6
use Wonderland\Thread\Event\PoolEvent;
7
use Wonderland\Thread\Mediator\Listener\AbstractListener;
8
9
class TestListener extends AbstractListener
10
{
11
    /**
12
     * @return array
13
     */
14
    public function getEventMapping(): array
15
    {
16
        return [
17
            PoolEvent::POOL_WAIT_TICK_PID_REMOVED => 'onTickRemoved',
18
            TestEvent::EVENT_NAME => 'onTestEvent'
19
        ];
20
    }
21
22
    /**
23
     * @param PoolEvent $event
24
     */
25
    public function onTickRemoved(PoolEvent $event)
26
    {
27
        echo $event->getThreadLeftNb() . PHP_EOL;
28
    }
29
30
    /**
31
     * @param TestEvent $event
32
     */
33
    public function onTestEvent(TestEvent $event)
34
    {
35
        echo $event->getEventParam() . PHP_EOL;
36
    }
37
}