Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
ExampleListener
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 1
 onMySomeEvent
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 onMyEvent
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 doSomeWork
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * This file is part of the sshilko/php-sql-mydb package.
4 *
5 * (c) Sergei Shilko <contact@sshilko.com>
6 *
7 * MIT License
8 *
9 * For the full copyright and license information, please view the LICENSE
10 * file that was distributed with this source code.
11 * @license https://opensource.org/licenses/mit-license.php MIT
12 */
13
14declare(strict_types = 1);
15
16namespace sql\MydbEvent;
17
18use function serialize;
19
20class ExampleListener
21{
22
23    public function onMySomeEvent(): callable
24    {
25        return function (array $payload): void {
26            $this->doSomeWork($payload);
27        };
28    }
29
30    public function onMyEvent(): callable
31    {
32        return function (array $payload): void {
33            $this->doSomeWork($payload);
34        };
35    }
36
37    protected function doSomeWork(array $data): string
38    {
39        return serialize($data) . "\n";
40    }
41}