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 (#5715)
by Cristian
11:33
created

LifecycleHooks::trigger()   A

Complexity

Conditions 6
Paths 10

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

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