Showing 84 of 241 total issues
Function _addData
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function _addData($data, $scope, $forceReload = false)
{
$source = debug_backtrace()[1]['function'];
if (isset($this->sourceMap[$source])) {
$source = $this->sourceMap[$source];
- 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 _isInheritanceConflict
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function _isInheritanceConflict($classes)
{
$count = count($classes);
$classes = array_reverse($classes);
for ($i = 1; $i < $count; $i++) {
- 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 getCategory
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected static function getCategory($timerName)
{
if (isset(self::$sectionMap[$timerName])) {
return self::CATEGORY_SECTION;
}
- 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 formatArgs
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function formatArgs($args)
{
$result = [];
foreach ($args as $key => $item) {
if ('object' === $item[0]) {
- 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 find
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public function find($ip, $url, $limit, $method, $start = null, $end = null, $statusCode = null)
Function getMenuBlocks
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getMenuBlocks()
{
if (!$this->getProfile()) {
return [];
}
- 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 getVersion
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function getVersion()
{
if (self::$version === null && class_exists('Mage') && $config = Mage::getConfig()) {
//try to load from magento
$config = $config->getModuleConfig('Ecocode_Profiler');
- 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 getUserConfig
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function getUserConfig($asArray = false)
{
if (!$this->userConfig || $asArray) {
$userConfigFile = $this->getUserConfigFile();
- 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 createProfileFromData
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function createProfileFromData($token, $data, $parent = null)
{
$profile = new Ecocode_Profiler_Model_Profile($token);
$profile->setIp($data['ip']);
$profile->setMethod($data['method']);
- 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 find
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function find($ip, $url, $limit, $method, $start, $end)
Function write
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function write(Ecocode_Profiler_Model_Profile $profile)
{
$file = $this->getFilename($profile->getToken());
$profileIndexed = is_file($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 collect
has a Cognitive Complexity of 8 (exceeds 5 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,
- 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 find
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function find($ip, $url, $limit, $method, $start = null, $end = null);
Function getCookies
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getCookies($format = self::COOKIES_FLAT)
{
if (!in_array($format, [self::COOKIES_FLAT, self::COOKIES_ARRAY])) {
throw new \InvalidArgumentException(sprintf('Format "%s" invalid (%s).', $format, implode(', ', [self::COOKIES_FLAT, self::COOKIES_ARRAY])));
}
- 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
Consider simplifying this complex logical expression. Open
if ((!isset($_SERVER['ALLOW_PROFILER']) || $_SERVER['ALLOW_PROFILER'] !== '1') && (
isset($_SERVER['HTTP_CLIENT_IP'])
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|| !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1']) || php_sapi_name() === 'cli-server')
)
Function getRequestJsonData
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getRequestJsonData()
{
$eventList = $this->getCollector()->getEvents();
$events = [];
foreach ($eventList as $name => $event) {
- 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 beforeToHtml
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function beforeToHtml(Varien_Event_Observer $observer)
{
/** @var Mage_Core_Block_Abstract $block */
$block = $observer->getEvent()->getData('block');
$id = uniqid();
- 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 translate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function translate($args)
{
$argsCopy = $args;
$this->currentMessage = [
'locale' => $this->_locale,
- 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 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 getCacheControlHeader
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function getCacheControlHeader()
{
$parts = [];
ksort($this->cacheControl);
foreach ($this->cacheControl as $key => $value) {
- 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"