ApisGeneratorServiceProviders::publishesPackages()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
cc 1
eloc 15
c 2
b 0
f 1
nc 1
nop 0
dl 0
loc 18
rs 9.7666
1
<?php
2
3
namespace KMLaravel\ApiGenerator\Providers;
4
use Illuminate\Filesystem\Filesystem;
0 ignored issues
show
Bug introduced by
The type Illuminate\Filesystem\Filesystem 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...
5
use Illuminate\Support\ServiceProvider;
6
use KMLaravel\ApiGenerator\Helpers\KMFile;
7
use KMLaravel\ApiGenerator\Helpers\KMFunctions;
8
use KMLaravel\ApiGenerator\Helpers\KMGeneratorCommand;
9
use KMLaravel\ApiGenerator\Helpers\KMRoutes;
10
11
class ApisGeneratorServiceProviders extends ServiceProvider
12
{
13
14
    public function boot(){
15
        $this->registerFacades();
16
        $this->publishesPackages();
17
        $this->loadResource();
18
19
    }
20
21
    public function register(){
22
    }
23
24
    /**
25
     *
26
     */
27
    protected function publishesBaseControllers()
28
    {
29
30
    }
31
32
    /**
33
     *
34
     */
35
    protected function registerFacades()
36
    {
37
        $this->app->singleton("KMFileFacade" , function ($app){
38
            return new KMFile();
39
        });
40
        $this->app->singleton("KMRoutesFacade" , function ($app){
41
            return new KMRoutes();
42
        });
43
        $this->app->singleton("KMFunctionsFacade" , function ($app){
44
            return new KMFunctions();
45
        });
46
        $this->app->singleton("KMGeneratorCommandFacade" , function ($app){
47
            return new KMGeneratorCommand();
48
        });
49
    }
50
51
    /**
52
     *
53
     */
54
    protected function publishesPackages()
55
    {
56
        $asset = __DIR__."/../Asset/";
57
        $views = "views/ApisGenerator";
58
        $scriptPath = "ApisGenerator/scripts";
59
        $cssPath = "ApisGenerator/css";
60
        $this->publishes([
61
            __DIR__."/../Config/apis_generator.php" => config_path("apis_generator.php")
62
        ] , "apis-generator-config");
63
64
        $this->publishes([
65
            $asset."create.blade.php" => resource_path("$views/create.blade.php"),
66
            $asset."index.blade.php" => resource_path("$views/index.blade.php"),
67
            $asset."credential.json" => resource_path("$views/credential.json"),
68
            $asset."_layouts.blade.php" => resource_path("$views/layouts/_layouts.blade.php"),
69
            $asset."script.js" => public_path("$scriptPath/script.js"),
70
            $asset."css.css" => public_path("$cssPath/css.css"),
71
        ] , "apis-generator-asset");
72
73
    }
74
75
    /**
76
     *
77
     */
78
    private function loadResource()
79
    {
80
        $slash = DIRECTORY_SEPARATOR;
81
        $this->loadRoutesFrom(__DIR__.$slash."..".$slash."Routes".$slash."Routes.php");
82
    }
83
84
}
85