Completed
Push — main ( 187954...7a85d8 )
by Tan
19s queued 15s
created

BlogApiServiceProvider::resourceOverride()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace CSlant\Blog\Api\Providers;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class BlogApiServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Bootstrap services.
11
     *
12
     * @return void
13
     */
14
    public function boot(): void
15
    {
16
        $routePath = __DIR__.'/../../routes/blog-api.php';
17
        if (file_exists($routePath)) {
18
            $this->loadRoutesFrom($routePath);
19
        }
20
21
        $this->loadTranslationsFrom(__DIR__.'/../../lang', 'blog-api');
22
23
        $this->registerCommands();
24
25
        $this->registerAssetPublishing();
26
        $this->resourceOverride();
27
    }
28
29
    /**
30
     * Register services.
31
     *
32
     * @return void
33
     */
34
    public function register(): void
35
    {
36
        $configPath = __DIR__.'/../../config/blog-api.php';
37
        $this->mergeConfigFrom($configPath, 'blog-api');
38
    }
39
40
    /**
41
     * Get the services provided by the provider.
42
     *
43
     * @return null|array<string>
44
     */
45
    public function provides(): ?array
46
    {
47
        return ['blog-api'];
48
    }
49
50
    /**
51
     * @return void
52
     */
53
    protected function registerCommands(): void
54
    {
55
        $this->commands([
56
            //
57
        ]);
58
    }
59
60
    /**
61
     * @return void
62
     */
63
    protected function registerAssetPublishing(): void
64
    {
65
        $configPath = __DIR__.'/../../config/blog-api.php';
66
        $this->publishes([
67
            $configPath => config_path('blog-api.php'),
68
        ], 'config');
69
70
        $this->publishes([
71
            __DIR__.'/../../lang' => resource_path('lang/packages/blog-api'),
72
        ], 'lang');
73
    }
74
75
    /**
76
     * Override resource of the package.
77
     */
78
    public function resourceOverride(): void
79
    {
80
        $this->app->bind(
81
            \Botble\Blog\Http\Resources\TagResource::class,
0 ignored issues
show
Bug introduced by
The type Botble\Blog\Http\Resources\TagResource 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...
82
            \CSlant\Blog\Api\Http\Resources\TagResource::class
83
        );
84
    }
85
}
86