Issues (20)

src/ServiceProvider.php (1 issue)

Severity
1
<?php 
2
3
namespace Yaro\LogEnvelope;
4
5
class ServiceProvider extends \Illuminate\Support\ServiceProvider
6
{
7
8
    protected $defer = false;
9
10
    /**
11
     * Bootstrap the application events.
12
     */
13
    public function boot()
14
    {
15
        /*
16
         * Publish configuration file
17
         */
18
        $this->publishes([
19
            __DIR__ . '/../config/log-envelope.php' => config_path('yaro.log-envelope.php'),
20
        ]);
21
22
        /*
23
         * Publish migration if not published yet
24
         */
25
        if (!$this->migrationHasAlreadyBeenPublished()) {
26
            $timestamp = date('Y_m_d_His', time());
27
            $this->publishes([
28
                __DIR__ . '/../resources/migrations/create_exceptions_table.php.stub' => database_path('migrations/' . $timestamp . '_create_exceptions_table.php'),
29
            ], 'migrations');
30
        }
31
32
        $this->app['view']->addNamespace('log-envelope', __DIR__ . '/../resources/views');
33
34
        $loader = \Illuminate\Foundation\AliasLoader::getInstance();
35
        $loader->alias('LogEnvelope', 'Yaro\LogEnvelope\Facade');
36
    }
37
38
    /**
39
     * Register the service provider.
40
     */
41
    public function register()
42
    {
43
        config([
44
            'config/yaro.log-envelope.php',
45
        ]);
46
47
        $this->app->singleton('yaro.log-envelope', function($app) {
0 ignored issues
show
The parameter $app is not used and could be removed. ( Ignorable by Annotation )

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

47
        $this->app->singleton('yaro.log-envelope', function(/** @scrutinizer ignore-unused */ $app) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
48
            return new LogEnvelope();
49
        });
50
    }
51
52
    /**
53
     * @return bool
54
     */
55
    protected function migrationHasAlreadyBeenPublished()
56
    {
57
        $files = glob(database_path('/migrations/*_create_exceptions_table.php'));
58
        return count($files) > 0;
59
    }
60
61
}
62