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.

MakeControllerCommand::formatContent()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

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