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 = [];
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
Function collectSessionData
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function collectSessionData()
{
$namespaceData = [];
$storeData = [];
$rawSessionData = $this->getRawSession();
- 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 collect
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function collect(Mage_Core_Controller_Request_Http $request, Mage_Core_Controller_Response_Http $response, \Exception $exception = null)
{
$responseHeaders = $this->collectResponseHeaders($response);
// attributes are serialized and as they can be anything, they need to be converted to strings.
$requestAttributes = $this->collectRequestAttributes($request);
Method collectSessionData
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function collectSessionData()
{
$namespaceData = [];
$storeData = [];
$rawSessionData = $this->getRawSession();
Function captureFlashMessages
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function captureFlashMessages()
{
$messages = [];
foreach ($this->getRawSession() as $namespace => $data) {
if (!isset($data['messages'])) {
- 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 parseController
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function parseController($controller)
{
if (is_object($controller)) {
/** @var Mage_Core_Controller_Varien_Front $controller */
Function detectStatusCode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function detectStatusCode(Mage_Core_Controller_Response_Http $response)
{
$statusCode = $response->getHttpResponseCode();
foreach ($response->getHeaders() as $header) {
if (substr($header['name'], 0, 5) === 'Http/') {
- 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 parseController
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function parseController($controller)
{
if (is_object($controller)) {
/** @var Mage_Core_Controller_Varien_Front $controller */
- 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
Missing class import via use statement (line '503', column '41'). Open
$controllerReflection = new \ReflectionClass($controller);
- 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
Missing class import via use statement (line '603', column '22'). Open
$class = new ReflectionClass('Mage_Core_Model_App');
- 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
Missing class import via use statement (line '287', column '20'). Open
return new Ecocode_Profiler_Model_Http_ParameterBag($this->data['request_query']);
- 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
Missing class import via use statement (line '542', column '22'). Open
$class = new ReflectionClass('Mage_Core_Controller_Request_Http');
- 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
Missing class import via use statement (line '307', column '20'). Open
return new Ecocode_Profiler_Model_Http_ParameterBag($this->data['request_attributes']);
- 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
Missing class import via use statement (line '297', column '20'). Open
return new Ecocode_Profiler_Model_Http_ParameterBag($this->data['request_server']);
- 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
Missing class import via use statement (line '489', column '45'). Open
$actionReflection = new \ReflectionMethod(
- 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
Missing class import via use statement (line '292', column '20'). Open
return new Ecocode_Profiler_Model_Http_HeaderBag($this->data['request_headers']);
- 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
Missing class import via use statement (line '312', column '20'). Open
return new Ecocode_Profiler_Model_Http_ResponseHeaderBag($this->data['response_headers']);
- 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
Missing class import via use statement (line '282', column '20'). Open
return new Ecocode_Profiler_Model_Http_ParameterBag($this->data['request_request']);
- 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
Missing class import via use statement (line '302', column '20'). Open
return new Ecocode_Profiler_Model_Http_ParameterBag($this->data['request_cookies']);
- 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
Avoid excessively long class names like Ecocode_Profiler_Model_Collector_RequestDataCollector. Keep class name length under 40. Open
class Ecocode_Profiler_Model_Collector_RequestDataCollector
extends Ecocode_Profiler_Model_Collector_AbstractDataCollector
{
protected $messages = [];
- 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 {
}