We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Total Complexity | 6 |
Total Lines | 23 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | final class BackpackHooks |
||
6 | { |
||
7 | public array $hooks = []; |
||
8 | |||
9 | public static function register(string $hook, string|array $operations, callable $callback): void |
||
10 | { |
||
11 | $operations = is_array($operations) ? $operations : [$operations]; |
||
|
|||
12 | |||
13 | foreach ($operations as $operation) { |
||
14 | self::$hooks[$operation][$hook] = $callback; |
||
15 | } |
||
16 | } |
||
17 | |||
18 | public static function run(string $hook, string $operation, array $parameters): void |
||
19 | { |
||
20 | if (isset(self::$operationHooks[$operation][$hook])) { |
||
21 | self::$hooks[$operation][$hook](...$parameters); |
||
22 | } |
||
23 | } |
||
24 | |||
25 | public static function has(string $hook, string $operation): bool |
||
28 | } |
||
29 | } |
||
30 |