Issues (37)

src/TodoBarServiceProvider.php (3 issues)

1
<?php
2
3
namespace TPaksu\TodoBar;
4
5
use Illuminate\Support\ServiceProvider;
0 ignored issues
show
The type Illuminate\Support\ServiceProvider was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use TPaksu\TodoBar\Storage\DataStorageInterface;
7
8
class TodoBarServiceProvider extends ServiceProvider
9
{
10
11
    /**
12
     * Bootstrap the application services.
13
     *
14
     * @return void
15
     */
16
    public function boot()
17
    {
18
        $this->loadRoutesFrom(__DIR__ . '/routes/web.php');
19
        $this->loadViewsFrom(__DIR__ . '/resources/views', 'laravel-todobar');
20
        $this->mergeConfigFrom(__DIR__ . '/config/todobar.php', "todobar");
21
        $this->publishes([
22
            __DIR__ . '/config/todobar.php' => config_path('todobar.php'),
23
            __DIR__ . '/resources/views' => base_path('resources/views/tpaksu/todobar'),
24
        ]);
25
    }
26
27
    /**
28
     * Register the application services.
29
     *
30
     * @return void
31
     */
32
    public function register()
33
    {
34
        if (config('todobar.enabled', false) === true) {
0 ignored issues
show
The function config 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

34
        if (/** @scrutinizer ignore-call */ config('todobar.enabled', false) === true) {
Loading history...
35
            $this->app->make('TPaksu\TodoBar\Controllers\TodoBarController');
36
            $this->app["router"]->pushMiddlewareToGroup("web", "\TPaksu\TodoBar\Middleware\TodoBarMiddleware");
37
        }
38
39
        $this->app->singleton(DataStorageInterface::class, function() {
40
            $storage = config("todobar.storage.engine", Storage\JSONStorage::class);
0 ignored issues
show
The function config 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

40
            $storage = /** @scrutinizer ignore-call */ config("todobar.storage.engine", Storage\JSONStorage::class);
Loading history...
41
            $config = config("todobar.storage.params", ["file" => "items.json"]);
42
            if (class_exists($storage)) {
43
                return new $storage($config);
44
            }
45
            return new Storage\JSONStorage(["file" => "items.json"]);
46
        });
47
    }
48
}
49