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.
Passed
Push — master ( 9449cf...4032bb )
by Steeven
02:31
created

Make::getPhpTemplateFile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of the O2System Framework package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @author         Steeve Andrian Salim
9
 * @copyright      Copyright (c) Steeve Andrian Salim
10
 */
11
12
// ------------------------------------------------------------------------
13
14
namespace O2System\Framework\Cli\Commanders;
15
16
// ------------------------------------------------------------------------
17
18
use O2System\Framework\Cli\Commander;
19
20
/**
21
 * Class Make
22
 *
23
 * @package O2System\Framework\Cli\Commanders
24
 */
25
class Make extends Commander
26
{
27
    /**
28
     * Make::$commandVersion
29
     *
30
     * Command version.
31
     *
32
     * @var string
33
     */
34
    protected $commandVersion = '1.0.0';
35
36
    /**
37
     * Make::$commandDescription
38
     *
39
     * Command description.
40
     *
41
     * @var string
42
     */
43
    protected $commandDescription = 'CLI_MAKE_DESC';
44
45
    /**
46
     * Make::$commandOptions
47
     *
48
     * Command options.
49
     *
50
     * @var array
51
     */
52
    protected $commandOptions = [
53
        'name'      => [
54
            'description' => 'CLI_MAKE_NAME_DESC',
55
            'required'    => true,
56
        ],
57
        'path'      => [
58
            'description' => 'CLI_MAKE_PATH_DESC',
59
            'required'    => false,
60
        ],
61
        'filename'  => [
62
            'description' => 'CLI_MAKE_FILENAME_DESC',
63
            'required'    => true,
64
        ],
65
        'namespace' => [
66
            'description' => 'CLI_MAKE_NAMESPACE_DESC',
67
            'shortcut'    => 'ns',
68
            'required'    => false,
69
        ],
70
    ];
71
72
    /**
73
     * Make::$path
74
     *
75
     * Make path.
76
     *
77
     * @var string
78
     */
79
    protected $optionPath;
80
81
    /**
82
     * Make::$filename
83
     *
84
     * Make filename.
85
     *
86
     * @var string
87
     */
88
    protected $optionFilename;
89
90
    // ------------------------------------------------------------------------
91
92
    /**
93
     * Make::optionPath
94
     *
95
     * @param string $path
96
     */
97
    public function optionPath($path)
98
    {
99
        $path = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $path);
100
        $path = PATH_ROOT . str_replace(PATH_ROOT, '', $path);
0 ignored issues
show
Bug introduced by
The constant O2System\Framework\Cli\Commanders\PATH_ROOT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
101
102
        if (pathinfo($path, PATHINFO_EXTENSION)) {
103
            $this->optionFilename(pathinfo($path, PATHINFO_FILENAME));
104
            $path = dirname($path);
105
        }
106
107
        $this->optionPath = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
108
    }
109
110
    // ------------------------------------------------------------------------
111
112
    /**
113
     * Make::optionFilename
114
     *
115
     * @param string $name
116
     */
117
    public function optionFilename($name)
118
    {
119
        $name = str_replace('.php', '', $name);
120
        $this->optionFilename = prepare_filename($name) . '.php';
121
122
        $this->optionPath = empty($this->optionPath) ? modules()->top()->getRealPath() : $this->optionPath;
0 ignored issues
show
Bug introduced by
The method top() does not exist on O2System\Framework\Conta...s\DataStructures\Module. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

122
        $this->optionPath = empty($this->optionPath) ? modules()->/** @scrutinizer ignore-call */ top()->getRealPath() : $this->optionPath;

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
123
    }
124
125
    // ------------------------------------------------------------------------
126
127
    /**
128
     * Make::optionName
129
     *
130
     * @param string $name
131
     */
132
    public function optionName($name)
133
    {
134
        $this->optionFilename($name);
135
    }
136
137
    // ------------------------------------------------------------------------
138
139
    /**
140
     * Make::optionNamespace
141
     *
142
     * @param string $namespace
143
     */
144
    public function optionNamespace($namespace)
145
    {
146
        $this->namespace = $namespace;
0 ignored issues
show
Bug Best Practice introduced by
The property namespace does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
147
    }
148
149
    // ------------------------------------------------------------------------
150
151
    /**
152
     * Make::getPhpTemplateFile
153
     *
154
     * @param string $filename
155
     */
156
    public function getPhpTemplateFile($filename)
0 ignored issues
show
Unused Code introduced by
The parameter $filename is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

156
    public function getPhpTemplateFile(/** @scrutinizer ignore-unused */ $filename)

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

Loading history...
157
    {
158
        $directories = [
0 ignored issues
show
Unused Code introduced by
The assignment to $directories is dead and can be removed.
Loading history...
159
            PATH_FRAMEWORK . 'Config' . DIRECTORY_SEPARATOR . 'PhpTemplateFiles',
160
        ];
161
162
    }
163
}