Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Passed
Pull Request — main (#5687)
by Pedro
14:53
created

OperationHooks::has()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Backpack\CRUD\app\Library\CrudPanel\Hooks;
4
5
final class OperationHooks
6
{
7
    const BEFORE_OPERATION_SETUP = 'beforeOperationSetup';
8
    const AFTER_OPERATION_SETUP = 'afterOperationSetup';
9
    const SETUP_OPERATION_FROM_CONFIG = 'setupOperationFromConfig';
10
11
    public array $hooks = [];
12
13
    public function register(string $hook, string|array $operations, callable $callback): void
14
    {
15
        $operations = is_array($operations) ? $operations : [$operations];
0 ignored issues
show
introduced by
The condition is_array($operations) is always true.
Loading history...
16
17
        foreach ($operations as $operation) {
18
            $this->hooks[$operation][$hook][] = $callback;
19
        }
20
    }
21
22
    public function run(string $hook, string|array $operations, array $parameters): void
23
    {
24
        $operations = is_array($operations) ? $operations : [$operations];
0 ignored issues
show
introduced by
The condition is_array($operations) is always true.
Loading history...
25
        foreach ($operations as $operation) {
26
            if (isset($this->hooks[$operation][$hook])) {
27
                foreach ($this->hooks[$operation][$hook] as $callback) {
28
                    $callback(...$parameters);
29
                }
30
            }
31
        }
32
    }
33
34
    public function has(string $hook, string $operation): bool
35
    {
36
        return isset($this->hooks[$operation][$hook]);
37
    }
38
}
39