Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
| PluginEvent | |
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
4 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getData | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setOutput | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getOutput | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * The main PluginEvent class |
| 5 | * |
| 6 | * The PluginEvent class is used to pass data between plugins and the application. |
| 7 | * |
| 8 | * This Source Code Form is subject to the terms of the Mozilla Public License, |
| 9 | * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
| 10 | * obtain one at https://mozilla.org/MPL/2.0/. |
| 11 | * |
| 12 | * @package phpMyFAQ |
| 13 | * @author Thorsten Rinne <thorsten@phpmyfaq.de> |
| 14 | * @copyright 2024-2026 phpMyFAQ Team |
| 15 | * @license https://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
| 16 | * @link https://www.phpmyfaq.de |
| 17 | * @since 2024-07-10 |
| 18 | */ |
| 19 | |
| 20 | declare(strict_types=1); |
| 21 | |
| 22 | namespace phpMyFAQ\Plugin; |
| 23 | |
| 24 | use Symfony\Contracts\EventDispatcher\Event; |
| 25 | |
| 26 | class PluginEvent extends Event |
| 27 | { |
| 28 | private string $output = ''; |
| 29 | |
| 30 | public function __construct( |
| 31 | private readonly mixed $data, |
| 32 | ) { |
| 33 | } |
| 34 | |
| 35 | public function getData(): mixed |
| 36 | { |
| 37 | return $this->data; |
| 38 | } |
| 39 | |
| 40 | public function setOutput(string $output): void |
| 41 | { |
| 42 | $this->output .= $output; |
| 43 | } |
| 44 | |
| 45 | public function getOutput(): string |
| 46 | { |
| 47 | return $this->output; |
| 48 | } |
| 49 | } |