ScaffolderServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 6
dl 0
loc 67
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 16 2
B register() 0 29 1
A provides() 0 4 1
1
<?php
2
3
namespace Scaffolder;
4
5
use Illuminate\Support\ServiceProvider;
6
use Scaffolder\Commands\ClearCacheCommand;
7
use Scaffolder\Commands\GeneratorCommand;
8
use Scaffolder\Commands\ServeCommand;
9
use Scaffolder\Commands\BuildCommand;
10
11
class ScaffolderServiceProvider extends ServiceProvider
12
{
13
	/**
14
	 * Bootstrap the application services.
15
	 */
16
	public function boot()
17
	{
18
		// Scaffolder config
19
		$this->publishes([
20
			__DIR__ . '/../../config/' => base_path('scaffolder-config/')
21
		], 'config');
22
23
		// Generator views
24
		//$this->loadViewsFrom(__DIR__ . '/../../views', 'scaffolder');
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
25
26
		// Generator routes
27
		if (!$this->app->routesAreCached())
28
		{
29
			require __DIR__ . '/../../routes/generator.php';
30
		}
31
	}
32
33
	/**
34
	 * Register the service provider.
35
	 *
36
	 * @return void
37
	 */
38
	public function register()
39
	{
40
		$this->app->singleton('scaffolder.command.generate', function ($app)
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed.

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

Loading history...
41
		{
42
			return new GeneratorCommand();
43
		});
44
45
		$this->app->singleton('scaffolder.command.cache.clear', function ()
46
		{
47
			return new ClearCacheCommand();
48
		});
49
50
		$this->app->singleton('scaffolder.command.build', function ()
51
		{
52
			return new BuildCommand();
53
		});
54
55
		$this->app->singleton('scaffolder.command.serve', function ()
56
		{
57
			return new ServeCommand();
58
		});
59
60
		$this->commands([
61
			'scaffolder.command.generate',
62
			'scaffolder.command.cache.clear',
63
			'scaffolder.command.build',
64
			'scaffolder.command.serve'
65
		]);
66
	}
67
68
	/**
69
	 * Get the services provided by the provider.
70
	 *
71
	 * @return array
72
	 */
73
	public function provides()
74
	{
75
		return ['scaffolder.command.generate', 'scaffolder.command.cache.clear', 'scaffolder.command.serve', 'scaffolder.command.build'];
76
	}
77
}