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

Test Failed
Pull Request — main (#5688)
by Pedro
39:29 queued 16:36
created

BackpackManager::getControllerCrud()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Backpack\CRUD;
4
5
use Backpack\CRUD\app\Http\Controllers\Contracts\CrudControllerContract;
6
use Backpack\CRUD\app\Library\CrudPanel\CrudPanel;
7
8
final class BackpackManager
9
{
10
    private array $cruds;
11
12
    public function crud(CrudControllerContract $controller): CrudPanel
13
    {
14
        $controllerClass = get_class($controller);
15
16
        if (isset($this->cruds[$controllerClass])) {
17
            return $this->cruds[$controllerClass];
18
        }
19
20
        $instance = new CrudPanel();
21
22
        $this->cruds[$controllerClass] = $instance;
23
24
        return $this->cruds[$controllerClass];
25
    }
26
27
    public function crudFromController(string $controller): CrudPanel
28
    {
29
        $controller = new $controller();
30
31
        $crud = $this->crud($controller);
32
33
        // TODO: it's hardcoded, but we should figure out a way to make it dynamic if needed.
34
        $crud->setOperation('list');
35
36
        $primaryControllerRequest = $this->cruds[array_key_first($this->cruds)]->getRequest();
37
38
        $controller->initializeCrud($primaryControllerRequest, 'list');
39
40
        return $this->cruds[get_class($controller)];
41
    }
42
43
    public function hasCrudController(string $controller): bool
44
    {
45
        return isset($this->cruds[$controller]);
46
    }
47
48
    public function getControllerCrud(string $controller): CrudPanel
49
    {
50
        return $this->cruds[$controller];
51
    }
52
}
53