GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

AloiaCmsServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 21
c 0
b 0
f 0
dl 0
loc 47
rs 10
ccs 15
cts 15
cp 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 5 1
A bindFacades() 0 16 1
A boot() 0 16 2
1
<?php
2
3
namespace AloiaCms;
4
5
use AloiaCms\Console\ConfigCommand;
6
use AloiaCms\Console\NewArticle;
7
use AloiaCms\Console\SitemapCommand;
8
use AloiaCms\Models\Article;
9
use AloiaCms\Models\ContentBlock;
10
use AloiaCms\Models\MetaTag;
11
use AloiaCms\Models\Page;
12
use Illuminate\Support\Collection;
13 83
use Illuminate\Support\ServiceProvider;
14
use Illuminate\Support\Str;
15 83
16
class AloiaCmsServiceProvider extends ServiceProvider
17 83
{
18 83
    public function register()
19
    {
20 83
        $this->mergeConfigFrom(__DIR__ . '/../config/aloiacms.php', 'aloiacms');
21
22 83
        $this->bindFacades();
23 83
    }
24 83
25
    public function boot()
26 83
    {
27 83
        $this->publishes([
28 83
            __DIR__ . '/../config/aloiacms.php' => config_path('aloiacms.php'),
29
        ], 'config');
30
31
        if ($this->app->runningInConsole()) {
32
            $this->commands([
33 83
                NewArticle::class,
34
                ConfigCommand::class,
35
                SitemapCommand::class,
36
            ]);
37
        }
38 83
39
        Collection::macro('keysToSnakeCase', function () {
40 83
            return $this->mapWithKeys(fn ($value, $key) => [Str::snake($key) => $value]);
0 ignored issues
show
Bug introduced by
The method mapWithKeys() does not exist on AloiaCms\AloiaCmsServiceProvider. ( Ignorable by Annotation )

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

40
            return $this->/** @scrutinizer ignore-call */ mapWithKeys(fn ($value, $key) => [Str::snake($key) => $value]);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
41 8
        });
42 83
    }
43 83
44
    /**
45
     * Bind the facades used by this package
46
     */
47
    private function bindFacades()
48
    {
49
        $this->app->bind(Article::class, function () {
50
            return new Article();
51
        });
52
53
        $this->app->bind(ContentBlock::class, function () {
54
            return new ContentBlock();
55
        });
56
57
        $this->app->bind(MetaTag::class, function () {
58
            return new MetaTag();
59
        });
60
61
        $this->app->bind(Page::class, function () {
62
            return new Page();
63
        });
64
    }
65
}
66