Method _
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$message,
$channel = self::CHANNEL_INFO,
$level = self::LEVEL_INFORMATIONAL,
$description = '',
$code = '',
Function _
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function _(
$message,
$channel = self::CHANNEL_INFO,
$level = self::LEVEL_INFORMATIONAL,
$description = '',
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Remove error control operator '@' on line 54. Open
public static function _(
$message,
$channel = self::CHANNEL_INFO,
$level = self::LEVEL_INFORMATIONAL,
$description = '',
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Avoid using empty try-catch blocks in _. Open
} catch (Exception $e) {
}
- Read upRead up
- Exclude checks
EmptyCatchBlock
Since: 2.7.0
Usually empty try-catch is a bad idea because you are silently swallowing an error condition and then continuing execution. Occasionally this may be the right thing to do, but often it's a sign that a developer saw an exception, didn't know what to do about it, and so used an empty catch to silence the problem.
Example
class Foo {
public function bar()
{
try {
// ...
} catch (Exception $e) {} // empty catch block
}
}
Source https://phpmd.org/rules/design.html#emptycatchblock
Avoid using short method names like Ajde_Log::_(). The configured minimum method name length is 3. Open
public static function _(
$message,
$channel = self::CHANNEL_INFO,
$level = self::LEVEL_INFORMATIONAL,
$description = '',
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like Ajde_Log::d(). The configured minimum method name length is 3. Open
public static function d($message, $description = '')
{
self::_($message, self::CHANNEL_INFO, self::LEVEL_INFORMATIONAL, $description);
}
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
The class Ajde_Log is not named in CamelCase. Open
class Ajde_Log extends Ajde_Object_Static
{
const CHANNEL_EXCEPTION = 'Exception';
const CHANNEL_ERROR = 'Error';
const CHANNEL_ROUTING = 'Routing';
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
The method _ is not named in camelCase. Open
public static function _(
$message,
$channel = self::CHANNEL_INFO,
$level = self::LEVEL_INFORMATIONAL,
$description = '',
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}