Showing 9 of 9 total issues
The method options has a boolean flag argument $array, which is a certain sign of a Single Responsibility Principle violation. Open
public function options($array = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Avoid using static access to class '\Yii' in method 'instance'. Open
$_instance = Yii::createObject(static::className());
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\yii\helpers\ArrayHelper' in method 'option'. Open
return ArrayHelper::getValue($this->options(true), $key, $default);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Opening brace should be on a new line Open
public static function instance() {
- Exclude checks
Expected 1 space after FOREACH keyword; 0 found Open
foreach($flash as $key => $value) {
- Exclude checks
Expected 1 newline at end of file; 0 found Open
}
- Exclude checks
The variable $_instance is not named in camelCase. Open
public static function instance() {
static $_instance;
if (!isset($_instance)) {
$_instance = Yii::createObject(static::className());
}
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $_instance is not named in camelCase. Open
public static function instance() {
static $_instance;
if (!isset($_instance)) {
$_instance = Yii::createObject(static::className());
}
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $_instance is not named in camelCase. Open
public static function instance() {
static $_instance;
if (!isset($_instance)) {
$_instance = Yii::createObject(static::className());
}
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}