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

MakeMiddlewareCommand::formatContent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 9

Duplication

Lines 16
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 16
loc 16
rs 9.4285
cc 1
eloc 9
nc 1
nop 1
1
<?php
2
3
namespace Caffeinated\Modules\Console\Generators;
4
5 View Code Duplication
class MakeMiddlewareCommand extends MakeCommand
0 ignored issues
show
Duplication introduced by
This class 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...
6
{
7
	/**
8
     * The name and signature of the console command.
9
     *
10
     * @var string
11
     */
12
    protected $signature = 'make:module:middleware
13
    	{slug : The slug of the module.}
14
    	{name : The name of the middleware class.}';
15
16
    /**
17
     * The console command description.
18
     *
19
     * @var string
20
     */
21
    protected $description = 'Create a new module middleware class';
22
23
    /**
24
     * String to store the command type.
25
     *
26
     * @var string
27
     */
28
    protected $type = 'Middleware';
29
30
    /**
31
     * Module folders to be created.
32
     *
33
	 * @var array
34
	 */
35
	protected $listFolders = [
36
		'Http/Middleware/'
37
	];
38
39
	/**
40
     * Module files to be created.
41
     *
42
	 * @var array
43
	 */
44
	protected $listFiles = [
45
		'{{filename}}.php'
46
	];
47
48
	/**
49
     * Module stubs used to populate defined files.
50
     *
51
	 * @var array
52
	 */
53
	protected $listStubs = [
54
		'default' => [
55
			'middleware.stub'
56
		]
57
	];
58
59
	/**
60
     * Resolve Container after getting file path
61
     * 
62
     * @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...
63
     * @return Array
64
     */
65
    protected function resolveByPath($filePath)
66
    {
67
    	$this->container['filename']   = $this->makeFileName($filePath);
68
        $this->container['namespace']  = $this->getNamespace($filePath);
69
        $this->container['classname']  = basename($filePath);
70
    }
71
72
    /**
73
     * Replace placeholder text with correct values.
74
     *
75
     * @return string
76
     */
77
    protected function formatContent($content)
78
    {
79
        return str_replace(
80
            [
81
                '{{filename}}',
82
                '{{namespace}}', 
83
                '{{classname}}'
84
            ],
85
            [
86
                $this->container['filename'], 
87
                $this->container['namespace'], 
88
                $this->container['classname']
89
            ],
90
            $content
91
        );
92
    }
93
}