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 ( f85b6d...dc1691 )
by Shea
7s
created

MakeMigrationCommand::resolveByOption()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Caffeinated\Modules\Console\Generators;
4
5
class MakeMigrationCommand extends MakeCommand
6
{
7
	/**
8
     * The name and signature of the console command.
9
     *
10
     * @var string
11
     */
12
    protected $signature = 'make:module:migration
13
    	{slug : The slug of the module.}
14
    	{name : The name of the migration.}
15
    	{--create= : The table to be created.}
16
        {--table= : The table to migrate.}';
17
18
    /**
19
     * The console command description.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Create a new module migration file';
24
25
    /**
26
     * String to store the command type.
27
     *
28
     * @var string
29
     */
30
    protected $type = 'Migration';
31
32
    /**
33
     * Module folders to be created.
34
     *
35
	 * @var array
36
	 */
37
	protected $listFolders = [
38
		'Database/Migrations/'
39
	];
40
41
	/**
42
     * Module files to be created.
43
     *
44
	 * @var array
45
	 */
46
	protected $listFiles = [
47
		'{{filename}}.php'
48
	];
49
50
	/**
51
     * Module signature option.
52
     *
53
	 * @var array
54
	 */
55
	protected $signOption = [
56
		'create',
57
		'table'
58
	];
59
60
	/**
61
     * Module stubs used to populate defined files.
62
     *
63
	 * @var array
64
	 */
65
	protected $listStubs = [
66
		'default' => [
67
			'migration.stub'
68
		],
69
		
70
		'create' => [
71
			'migration_create.stub'
72
		],
73
74
		'table' => [
75
			'migration_table.stub'
76
		]
77
	];
78
79
	/**
80
     * Resolve Container after getting file path
81
     * 
82
     * @param  string $FilePath
0 ignored issues
show
Documentation introduced by
There is no parameter named $FilePath. Did you maybe mean $filePath?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
83
     * @return Array
84
     */
85
    protected function resolveByPath($filePath)
86
    {
87
    	$this->container['filename'] 	= $this->makeFileName($filePath);
88
		$this->container['classname'] 	= basename($filePath);
89
        $this->container['tablename']   = 'dummy';
90
    }
91
92
    /**
93
     * Resolve Container after getting input option
94
     * 
95
     * @param  string $option
96
     * @return Array
97
     */
98
    protected function resolveByOption($option)
99
    {
100
    	$this->container['tablename'] = $option;
101
    }
102
103
	/**
104
     * Make FileName 
105
     * 
106
     * @param  string $filePath
107
     * @return string          
108
     */
109
    protected function makeFileName($filePath)
110
    {
111
    	return date('Y_m_d_His').'_'.strtolower(snake_case(basename($filePath)));
112
    }
113
114
    /**
115
	 * Replace placeholder text with correct values.
116
	 *
117
	 * @return string
118
	 */
119
	protected function formatContent($content)
120
    {
121
        return str_replace(
122
			[
123
				'{{filename}}',
124
				'{{classname}}',
125
				'{{tablename}}'
126
			],
127
			[
128
				$this->container['filename'], 
129
				$this->container['classname'],
130
				$this->container['tablename']
131
			],
132
			$content
133
		);
134
    }
135
}