Issues (29)

src/GeneratorServiceProvider.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Shamaseen\Repository\Generator;
4
5
use Config;
6
use Illuminate\Support\ServiceProvider;
7
use Shamaseen\Repository\Generator\Commands\Generator;
8
use Shamaseen\Repository\Generator\Commands\Remover;
9
10
/**
11
 * Class GeneratorServiceProvider.
12
 */
13
class GeneratorServiceProvider extends ServiceProvider
14
{
15
    /**
16
     * Bootstrap services.
17
     */
18
    public function boot()
19
    {
20
        if ($this->app->runningInConsole()) {
21
            $this->commands([
22
                Generator::class,
23
                Remover::class
24
            ]);
25
        }
26
27
        $this->publishes([
28
            __DIR__.'/config' => realpath('config'),
29
        ], 'repository-generator');
30
31
        if (null === $this->app['config']->get('repository')) {
32
            $this->app['config']->set('repository', require __DIR__.'/config/repository.php');
33
        }
34
        $this->mergeConfigFrom(__DIR__.'/config/repository.php', 'repository-config');
35
        $resourcesPathStub = resource_path('/stubs');
0 ignored issues
show
The function resource_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

35
        $resourcesPathStub = /** @scrutinizer ignore-call */ resource_path('/stubs');
Loading history...
36
        $stubPath = realpath(__DIR__.'/../stubs');
37
        $langPath = Config::get('repository.lang_path').'/en';
38
39
        if (!is_dir($resourcesPathStub)) {
40
            mkdir($resourcesPathStub, 0777, true);
41
        }
42
43
        $this->publishes([
44
            $stubPath => Config::get('repository.stubs_path', $resourcesPathStub),
45
            __DIR__.'/lang' => $langPath,
46
        ], 'repository-stub');
47
    }
48
49
    /**
50
     * Register services.
51
     */
52
    public function register()
53
    {
54
    }
55
}
56