Showing 84 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
Ecocode_Profiler_Model_Profile
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
class Ecocode_Profiler_Model_Profile
{
protected $token;
/**
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));
Function renderNode
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function renderNode($node, $prefix = '', $sibling = false)
{
if (!$node['parent_id']) {
$start = $node['name'];
} else {
- 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 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 37 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)
{
$stats = [
'load' => 0,
'loop_load' => 0,
Method collectEvents
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function collectEvents(Ecocode_Profiler_Model_AppDev $app)
{
$eventList = $app->getFiredEvents();
$events = [];
Method find
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function find($ip, $url, $limit, $method, $start = null, $end = null, $statusCode = null)
{
$file = $this->getIndexFilename();
if (!file_exists($file)) {
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 sanitizeLogs
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function sanitizeLogs($logs)
{
$errorContextById = [];
$sanitizedLogs = [];
Consider simplifying this complex logical expression. Open
if ($ip && false === strpos($csvIp, $ip) || $url && false === strpos($csvUrl, $url) || $method && false === strpos($csvMethod, $method) || $statusCode && false === strpos($csvStatusCode, $statusCode)) {
continue;
}
Method getCategory
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function getCategory($timerName)
{
if (isset(self::$sectionMap[$timerName])) {
return self::CATEGORY_SECTION;
}