Completed
Push — master ( e83455...d2af9f )
by Andrii
06:07 queued 04:16
created

src/event/EventAwareTrait.php (1 issue)

1
<?php
2
declare(strict_types=1);
3
4
namespace hiqdev\php\billing\event;
5
6
use League\Event\EventInterface;
0 ignored issues
show
The type League\Event\EventInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
8
/**
9
 * Trait EventTrait
10
 *
11
 * @author Dmytro Naumenko <[email protected]>
12
 */
13
trait EventAwareTrait
14
{
15
    /**
16
     * @var EventInterface[]
17
     */
18
    private $events = [];
19
20
    /**
21
     * Registers that $event occurred
22
     * @param EventInterface $event
23
     */
24
    public function recordThat(EventInterface $event): void
25
    {
26
        $this->events[] = $event;
27
    }
28
29
    /**
30
     * @return EventInterface[] of occurred events
31
     */
32
    public function releaseEvents(): array
33
    {
34
        $events = $this->events;
35
        $this->events = [];
36
37
        return $events;
38
    }
39
}
40