GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 0f86b3...1262c4 )
by Alireza
13s
created

CreateControllerPanelCommand::fire()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 7

Duplication

Lines 15
Ratio 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 15
loc 15
rs 9.4285
cc 2
eloc 7
nc 2
nop 0
1
<?php namespace  Serverfireteam\Panel\Commands;
2
3
use Illuminate\Console\GeneratorCommand;
4
use Symfony\Component\Console\Input\InputOption;
5
6
class CreateControllerPanelCommand extends GeneratorCommand {
7
8
	/**	
9
	 *
10
	 * @var string contains the command name
11
	 */
12
	protected $name = 'panel:createcontroller';
13
14
	/**	
15
	 *
16
	 * @var string contains the description of command
17
	 */
18
	protected $description = 'Create a new resource controller class';
19
20
	/**
21
	 * The type of class being generated.
22
	 *
23
	 * @var string
24
	 */
25
	protected $type = 'Controller';
26
27
	/**
28
	 * Get the stub file for the generator.
29
	 *
30
	 * @return string Returns the stub file for generating the Controller
31
	 */
32
	protected function getStub()
33
	{
34
            if ($this->option('plain'))
35
            {
36
                    return __DIR__.'/stubs/controller.plain.stub';
37
            }
38
39
            return base_path().'/vendor/serverfireteam/panel/src/Serverfireteam/Panel/stubs/panelController.stub';
40
	}
41
42
	/**
43
	 * Get the default namespace for the class.
44
	 *
45
	 * @param  string  $rootNamespace
46
	 * @return string The namespace of the panel's controllers
47
	 */
48
	protected function getDefaultNamespace($rootNamespace)
49
	{
50
            $controllersPath = \Config::get('panel.controllers');
51
            if ( isset($controllersPath) && $controllersPath != NULL  ){
52
                return $controllersPath;
53
            } else {                
54
                return $rootNamespace.'\Http\Controllers';
55
            }            
56
	}
57
        
58
        /**
59
	 * Execute the console command.
60
	 *
61
	 * @return void
62
	 */
63 View Code Duplication
	public function handle()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
64
	{
65
            $name = $this->qualifyClass($this->getNameInput()) . 'Controller';
66
67
            if ($this->files->exists($path = $this->getPath($name)))
68
            {
69
                    return $this->error($this->type.' already exists!');
70
            }
71
72
            $this->makeDirectory($path);
73
74
            $this->files->put($path, $this->buildClass($name));
75
76
            $this->info($this->type.' created successfully.');
77
	}
78
79
	/**
80
	 * Get the console command options.
81
	 *
82
	 * @return array
83
	 */
84
	protected function getOptions()
85
	{
86
		return array(
87
			array('plain', null, InputOption::VALUE_NONE, 'Generate an empty controller class.'),
88
		);
89
	}
90
91
}
92