app/code/community/Ecocode/Profiler/Helper/Sql.php
Method formatQuery
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function formatQuery($sql, $highlightOnly = false)
{
if (@!class_exists('SqlFormatter')) {
return 'SqlFormatter is not installed';
}
Missing class import via use statement (line '53', column '27'). Open
Open
$dumper = new \Symfony\Component\Yaml\Dumper();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Remove error control operator '@' on line 46. Open
Open
public function dumpParameters(array $parameters)
{
if (!$parameters) {
return '{}';
}
- 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
Remove error control operator '@' on line 68. Open
Open
public function formatQuery($sql, $highlightOnly = false)
{
if (@!class_exists('SqlFormatter')) {
return 'SqlFormatter is not installed';
}
- 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 excessively long variable names like $formattedQueriesCache. Keep variable name length under 20. Open
Open
protected $formattedQueriesCache = [];
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}