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.

Issues (13)

src/UrlShortenerServiceProvider.php (4 issues)

Labels
Severity
1
<?php
2
3
namespace LaraCrafts\UrlShortener;
4
5
use GuzzleHttp\Client;
6
use GuzzleHttp\ClientInterface;
7
use Illuminate\Routing\UrlGenerator;
8
use Illuminate\Support\ServiceProvider;
9
use Illuminate\Support\Str;
10
11
class UrlShortenerServiceProvider extends ServiceProvider
12
{
13
    /**
14
     * Boot package services.
15
     *
16
     * @return void
17
     */
18
    public function boot()
19
    {
20
        $this->mergeConfigFrom(__DIR__ . '/../config/url-shortener.php', 'url-shortener');
21
        $this->publishAssets();
22
        $this->registerMacros();
23
    }
24
25
    /**
26
     * Publish package assets.
27
     *
28
     * @return void
29
     */
30
    protected function publishAssets()
31
    {
32
        if (!$this->app->runningInConsole() || Str::contains($this->app->version(), 'Lumen')) {
33
            return;
34
        }
35
36
        $this->publishes([
37
            __DIR__ . '/../config/url-shortener.php' => config_path('url-shortener.php'),
0 ignored issues
show
The function config_path was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

37
            __DIR__ . '/../config/url-shortener.php' => /** @scrutinizer ignore-call */ config_path('url-shortener.php'),
Loading history...
38
        ]);
39
    }
40
41
    /**
42
     * Register package services.
43
     *
44
     * @return void
45
     */
46
    public function register()
47
    {
48
        $this->app->alias('url.shortener', UrlShortenerManager::class);
49
        $this->app->bindIf(ClientInterface::class, Client::class);
50
51
        $this->app->singleton('url.shortener', function ($app) {
52
            return new UrlShortenerManager($app);
53
        });
54
    }
55
56
    /**
57
     * Register UrlGenerator macro's.
58
     *
59
     * @return void
60
     */
61
    protected function registerMacros()
62
    {
63
        if (!class_exists(UrlGenerator::class) || !method_exists(UrlGenerator::class, 'macro')) {
64
            return;
65
        }
66
67
        UrlGenerator::macro('shorten', function (...$parameters) {
68
            return app('url.shortener')->shorten(...$parameters);
0 ignored issues
show
The function app was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

68
            return /** @scrutinizer ignore-call */ app('url.shortener')->shorten(...$parameters);
Loading history...
69
        });
70
71
        UrlGenerator::macro('shortenAsync', function (...$parameters) {
72
            return app('url.shortener')->shortenAsync(...$parameters);
0 ignored issues
show
The function app was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

72
            return /** @scrutinizer ignore-call */ app('url.shortener')->shortenAsync(...$parameters);
Loading history...
73
        });
74
75
        UrlGenerator::macro('shortener', function () {
76
            return app('url.shortener');
0 ignored issues
show
The function app was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

76
            return /** @scrutinizer ignore-call */ app('url.shortener');
Loading history...
77
        });
78
    }
79
}
80