Total Complexity | 5 |
Total Lines | 53 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
10 | trait HasEvents |
||
11 | { |
||
12 | /** |
||
13 | * Determines whether pipeline uses events. |
||
14 | * |
||
15 | * @var bool |
||
16 | */ |
||
17 | protected bool $useEvents = false; |
||
18 | |||
19 | /** |
||
20 | * Enable events in pipeline. |
||
21 | * |
||
22 | * @return static |
||
23 | */ |
||
24 | 3 | public function withEvents(): static |
|
29 | } |
||
30 | |||
31 | /** |
||
32 | * Fire the started event if enabled. |
||
33 | * |
||
34 | * @param mixed $pipe |
||
35 | * @param mixed $passable |
||
36 | * |
||
37 | * @return void |
||
38 | */ |
||
39 | 24 | protected function fireStartedEvent($pipe, $passable): void |
|
46 | } |
||
47 | |||
48 | /** |
||
49 | * Fire the passed event if enabled. |
||
50 | * |
||
51 | * @param mixed $pipe |
||
52 | * @param mixed $passable |
||
53 | * |
||
54 | * @return void |
||
55 | */ |
||
56 | 16 | protected function firePassedEvent($pipe, $passable): void |
|
65 |