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

InstanceServiceProvider::makeSettingsInstance()   A
last analyzed

Complexity

Conditions 3
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 7
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 11
rs 9.4285
1
<?php
2
3
namespace App\Providers;
4
5
use Exception;
6
use App\Classes\PluginManager;
7
use App\Classes\SettingsManager;
8
use Illuminate\Foundation\Application;
9
use App\Exceptions\EngineBootException;
10
use Illuminate\Support\ServiceProvider;
11
use App\Classes\Repositories\PluginRepository;
12
use App\Classes\Repositories\SettingsRepository;
13
14
/**
15
 * Created by PhpStorm.
16
 * User: Mark
17
 * Date: 01/02/2017
18
 * Time: 10:05.
19
 */
20
class InstanceServiceProvider extends ServiceProvider
21
{
22
    /**
23
     * The application instance.
24
     *
25
     * @var Application
26
     */
27
    protected $app;
28
29
    /**
30
     * Bootstrap application.
31
     * @return void
32
     */
33
    public function boot()
34
    {
35
        $this->makeSettingsInstance();
36
37
        $this->makePluginInstance();
38
    }
39
40
    private function makeSettingsInstance()
41
    {
42
        $this->app->singleton(SettingsManager::class, function () {
43
            try {
44
                return (new SettingsManager)->collect(app(SettingsRepository::class)->all());
0 ignored issues
show
Bug introduced by
It seems like app(App\Classes\Reposito...pository::class)->all() can also be of type Illuminate\Database\Eloquent\Builder and App\Model\Setting; however, parameter $collection of App\Classes\SettingsManager::collect() does only seem to accept Illuminate\Support\Collection, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

44
                return (new SettingsManager)->collect(/** @scrutinizer ignore-type */ app(SettingsRepository::class)->all());
Loading history...
45
            } catch (Exception $e) {
46
                if ($this->app->runningInConsole()) {
47
                    return new SettingsManager;
48
                }
49
50
                throw new EngineBootException('Could not perform query on the `settings database`, do we have proper connection settings?');
51
            }
52
        });
53
    }
54
55
    private function makePluginInstance()
56
    {
57
        $this->app->singleton(PluginManager::class, function () {
58
            try {
59
                return (new PluginManager)->collect(app(PluginRepository::class)->all());
0 ignored issues
show
Bug introduced by
It seems like app(App\Classes\Reposito...pository::class)->all() can also be of type App\Model\Plugin and Illuminate\Database\Eloquent\Builder; however, parameter $collection of App\Classes\PluginManager::collect() does only seem to accept Illuminate\Support\Collection, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

59
                return (new PluginManager)->collect(/** @scrutinizer ignore-type */ app(PluginRepository::class)->all());
Loading history...
60
            } catch (Exception $e) {
61
                if ($this->app->runningInConsole()) {
62
                    return new PluginManager;
63
                }
64
65
                throw new EngineBootException('Could not perform query on the `plugins database`, do we have proper connection settings?');
66
            }
67
        });
68
    }
69
}
70