Showing 241 of 241 total issues
File RequestDataCollector.php
has 445 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Class Ecocode_Profiler_Model_Collector_RequestDataCollector
*/
Ecocode_Profiler_Model_Collector_RequestDataCollector
has 45 functions (exceeds 20 allowed). Consider refactoring. Open
class Ecocode_Profiler_Model_Collector_RequestDataCollector
extends Ecocode_Profiler_Model_Collector_AbstractDataCollector
{
protected $messages = [];
Function loadRewrites
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
public function loadRewrites()
{
if ($this->_rewrites === null) {
$files = ['config.xml', 'development.xml'];
$prototype = $this->_rewriteTypes;
- 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
Function sanitizeLogs
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
private function sanitizeLogs($logs)
{
$errorContextById = [];
$sanitizedLogs = [];
- 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
The class Ecocode_Profiler_Model_NullLogger has 11 public methods. Consider refactoring Ecocode_Profiler_Model_NullLogger to keep number of public methods under 10. Open
class Ecocode_Profiler_Model_NullLogger
implements Ecocode_Profiler_Model_LoggerInterface
{
public function mageLog($level, $message, array $context = [])
{
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
The class Ecocode_Profiler_Helper_Code has an overall complexity of 50 which is very high. The configured complexity threshold is 50. Open
class Ecocode_Profiler_Helper_Code
{
private $fileLinkFormat;
private $hostRootDir;
private $rootDir;
- Exclude checks
Ecocode_Profiler_Model_Profile
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
class Ecocode_Profiler_Model_Profile
{
protected $token;
/**
The class Ecocode_Profiler_Model_Http_HeaderBag has 11 public methods. Consider refactoring Ecocode_Profiler_Model_Http_HeaderBag to keep number of public methods under 10. Open
class Ecocode_Profiler_Model_Http_HeaderBag implements \IteratorAggregate, \Countable
{
protected $headers = [];
protected $cacheControl = [];
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
The class Ecocode_Profiler_Model_Collector_RequestDataCollector has an overall complexity of 90 which is very high. The configured complexity threshold is 50. Open
class Ecocode_Profiler_Model_Collector_RequestDataCollector
extends Ecocode_Profiler_Model_Collector_AbstractDataCollector
{
protected $messages = [];
- Exclude checks
The class Ecocode_Profiler_Model_Profiler_FileStorage has an overall complexity of 52 which is very high. The configured complexity threshold is 50. Open
class Ecocode_Profiler_Model_Profiler_FileStorage
implements Ecocode_Profiler_Model_Profiler_StorageInterface
{
/**
* Folder where profiler data are stored.
- Exclude checks
Function exportValue
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function exportValue($value, $depth = 1, $deep = false)
{
if (is_object($value)) {
if ($value instanceof \DateTimeInterface) {
return sprintf('Object(%s) - %s', get_class($value), $value->format(\DateTime::ISO8601));
- 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
Ecocode_Profiler_Model_Collector_ConfigDataCollector
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class Ecocode_Profiler_Model_Collector_ConfigDataCollector
extends Ecocode_Profiler_Model_Collector_AbstractDataCollector
{
/** @var Ecocode_Profiler_Helper_Data */
protected $helper;
Function find
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function find($ip, $url, $limit, $method, $start = null, $end = null, $statusCode = null)
{
$file = $this->getIndexFilename();
if (!file_exists($file)) {
- 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
Function collectEvents
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function collectEvents(Ecocode_Profiler_Model_AppDev $app)
{
$eventList = $app->getFiredEvents();
$events = [];
- 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
Method write
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function write(Ecocode_Profiler_Model_Profile $profile)
{
$file = $this->getFilename($profile->getToken());
$profileIndexed = is_file($file);
Method exportValue
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function exportValue($value, $depth = 1, $deep = false)
{
if (is_object($value)) {
if ($value instanceof \DateTimeInterface) {
return sprintf('Object(%s) - %s', get_class($value), $value->format(\DateTime::ISO8601));
Avoid excessively long class names like Ecocode_Profiler_Controller_AbstractController. Keep class name length under 40. Open
class Ecocode_Profiler_Controller_AbstractController
extends Mage_Core_Controller_Front_Action
{
/** @var Ecocode_Profiler_Model_Profiler */
protected $profiler;
- Read upRead up
- Exclude checks
LongClassName
Since: 2.9
Detects when classes or interfaces are declared with excessively long names.
Example
class ATooLongClassNameThatHintsAtADesignProblem {
}
interface ATooLongInterfaceNameThatHintsAtADesignProblem {
}
Source https://phpmd.org/rules/naming.html#longclassname
Avoid excessively long class names like Ecocode_Profiler_Model_Collector_AjaxDataCollector. Keep class name length under 40. Open
class Ecocode_Profiler_Model_Collector_AjaxDataCollector
extends Ecocode_Profiler_Model_Collector_AbstractDataCollector
{
/**
* {@inheritdoc}
- Read upRead up
- Exclude checks
LongClassName
Since: 2.9
Detects when classes or interfaces are declared with excessively long names.
Example
class ATooLongClassNameThatHintsAtADesignProblem {
}
interface ATooLongInterfaceNameThatHintsAtADesignProblem {
}
Source https://phpmd.org/rules/naming.html#longclassname
Avoid excessively long class names like Ecocode_Profiler_Model_Collector_LateDataCollectorInterface. Keep class name length under 40. Open
interface Ecocode_Profiler_Model_Collector_LateDataCollectorInterface
{
/**
* Collects data as late as possible.
*/
- Read upRead up
- Exclude checks
LongClassName
Since: 2.9
Detects when classes or interfaces are declared with excessively long names.
Example
class ATooLongClassNameThatHintsAtADesignProblem {
}
interface ATooLongInterfaceNameThatHintsAtADesignProblem {
}
Source https://phpmd.org/rules/naming.html#longclassname
Avoid excessively long class names like Ecocode_Profiler_Model_Collector_LayoutDataCollector. Keep class name length under 40. Open
class Ecocode_Profiler_Model_Collector_LayoutDataCollector
extends Ecocode_Profiler_Model_Collector_AbstractDataCollector
{
protected $renderLog = [];
protected $renderedBlocks = [];
- Read upRead up
- Exclude checks
LongClassName
Since: 2.9
Detects when classes or interfaces are declared with excessively long names.
Example
class ATooLongClassNameThatHintsAtADesignProblem {
}
interface ATooLongInterfaceNameThatHintsAtADesignProblem {
}