Function getBacktrace
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
public static function getBacktrace($minLevel = 1, $maxLevel = 0, $sep = '#')
{
$trace = '';
foreach (debug_backtrace() as $k => $v) {
if ($k < $minLevel) {
- 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 getBacktrace
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getBacktrace($minLevel = 1, $maxLevel = 0, $sep = '#')
{
$trace = '';
foreach (debug_backtrace() as $k => $v) {
if ($k < $minLevel) {
Method init
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function init()
{
$targets = [];
if (\App\Config::debug('LOG_TO_FILE')) {
$levels = \App\Config::debug('LOG_LEVELS');
Function consoleIsActive
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function consoleIsActive()
{
$ips = \Config\Debug::$DEBUG_CONSOLE_ALLOWED_IPS;
if (false === $ips || (\is_string($ips) && RequestUtil::getRemoteIP(true) === $ips) || (\is_array($ips) && \in_array(RequestUtil::getRemoteIP(true), $ips))) {
if (\Config\Debug::$DEBUG_CONSOLE_ALLOWED_USERS && !\in_array(\App\User::getCurrentUserRealId(), \Config\Debug::$DEBUG_CONSOLE_ALLOWED_USERS)) {
- 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 initConsole
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function initConsole()
{
if (\App\Config::debug('DISPLAY_DEBUG_CONSOLE') && static::consoleIsActive()) {
$debugbar = new Debug\DebugBar\DebugBar();
$debugbar->addCollector(new DataCollector\PhpInfoCollector());
- 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 init
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function init()
{
$targets = [];
if (\App\Config::debug('LOG_TO_FILE')) {
$levels = \App\Config::debug('LOG_LEVELS');
- 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 method getBacktrace() has an NPath complexity of 289. The configured NPath complexity threshold is 200. Open
public static function getBacktrace($minLevel = 1, $maxLevel = 0, $sep = '#')
{
$trace = '';
foreach (debug_backtrace() as $k => $v) {
if ($k < $minLevel) {
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method getBacktrace() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10. Open
public static function getBacktrace($minLevel = 1, $maxLevel = 0, $sep = '#')
{
$trace = '';
foreach (debug_backtrace() as $k => $v) {
if ($k < $minLevel) {
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
Refactor this function to reduce its Cognitive Complexity from 40 to the 15 allowed. Open
public static function getBacktrace($minLevel = 1, $maxLevel = 0, $sep = '#')
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
The class Debuger has a coupling between objects value of 15. Consider to reduce the number of dependencies under 13. Open
class Debuger
{
/**
* @var \DebugBar\Debuger
*/
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Missing class import via use statement (line '44', column '33'). Open
$debugbar->addCollector(new \DebugBar\DataCollector\ConfigCollector([
- 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 using static access to class '\App\Config' in method 'initConsole'. Open
'performance' => \App\Config::performance(),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Yii' in method 'init'. Open
\Yii::createObject([
'class' => 'yii\log\Dispatcher',
'traceLevel' => \App\Config::debug('LOG_TRACE_LEVEL'),
'targets' => $targets,
]);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\User' in method 'consoleIsActive'. Open
if (\Config\Debug::$DEBUG_CONSOLE_ALLOWED_USERS && !\in_array(\App\User::getCurrentUserRealId(), \Config\Debug::$DEBUG_CONSOLE_ALLOWED_USERS)) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'initConsole'. Open
'relation' => \App\Config::relation(),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'initConsole'. Open
if (\App\Config::debug('DISPLAY_DEBUG_CONSOLE') && static::consoleIsActive()) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\RequestUtil' in method 'consoleIsActive'. Open
if (false === $ips || (\is_string($ips) && RequestUtil::getRemoteIP(true) === $ips) || (\is_array($ips) && \in_array(RequestUtil::getRemoteIP(true), $ips))) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\RequestUtil' in method 'consoleIsActive'. Open
if (false === $ips || (\is_string($ips) && RequestUtil::getRemoteIP(true) === $ips) || (\is_array($ips) && \in_array(RequestUtil::getRemoteIP(true), $ips))) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'init'. Open
$levels = \App\Config::debug('LOG_LEVELS');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'initConsole'. Open
'debug' => \App\Config::debug(),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'init'. Open
if (\App\Config::debug('LOG_TO_FILE')) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'initConsole'. Open
'security' => \App\Config::security(),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'initConsole'. Open
'api' => \App\Config::api(),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'initConsole'. Open
if (\App\Config::debug('DISPLAY_LOGS_IN_CONSOLE')) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'init'. Open
$levels = \App\Config::debug('LOG_LEVELS');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'init'. Open
'traceLevel' => \App\Config::debug('LOG_TRACE_LEVEL'),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'initConsole'. Open
if (\App\Config::debug('DISPLAY_CONFIG_IN_CONSOLE')) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'initConsole'. Open
'search' => \App\Config::search(),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'initConsole'. Open
'developer' => \App\Config::developer(),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'init'. Open
if (\App\Config::debug('LOG_TO_PROFILE')) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'initConsole'. Open
'sounds' => \App\Config::sounds(),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Define a constant instead of duplicating this literal "class" 5 times. Open
'class' => 'App\Log\FileTarget',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Return type of initConsole()
is undeclared type \App\DebugBar\Debuger
(Did you mean class \App\Debuger) Open
public static function initConsole()
- Exclude checks
Call to method getCurrentUserRealId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
if (\Config\Debug::$DEBUG_CONSOLE_ALLOWED_USERS && !\in_array(\App\User::getCurrentUserRealId(), \Config\Debug::$DEBUG_CONSOLE_ALLOWED_USERS)) {
- Exclude checks
Call to method __construct
from undeclared class \DebugBar\DataCollector\requestdatacollector
Open
$debugbar->addCollector(new DataCollector\RequestDataCollector());
- Exclude checks
Call to method __construct
from undeclared class \DebugBar\DataCollector\ConfigCollector
Open
$debugbar->addCollector(new \DebugBar\DataCollector\ConfigCollector([
- Exclude checks
Call to undeclared method \App\Debug\DebugBar\DebugBar::addCollector
Open
$debugbar->addCollector(new Debug\DebugBarLogs());
- Exclude checks
Call to method __construct
from undeclared class \DebugBar\DataCollector\memorycollector
Open
$debugbar->addCollector(new DataCollector\MemoryCollector());
- Exclude checks
Static call to undeclared method \Yii::createObject
Open
\Yii::createObject([
- Exclude checks
Call to method __construct
from undeclared class \DebugBar\DataCollector\phpinfocollector
Open
$debugbar->addCollector(new DataCollector\PhpInfoCollector());
- Exclude checks
Call to undeclared method \App\Debug\DebugBar\DebugBar::addCollector
Open
$debugbar->addCollector(new DataCollector\PhpInfoCollector());
- Exclude checks
Call to undeclared method \App\Debug\DebugBar\DebugBar::addCollector
Open
$debugbar->addCollector(new DataCollector\ExceptionsCollector());
- Exclude checks
Call to undeclared method \App\Debug\DebugBar\DebugBar::addCollector
Open
$debugbar->addCollector(new DataCollector\TimeDataCollector());
- Exclude checks
Assigning \App\Debug\DebugBar\DebugBar
to property but \App\Debuger::$debugBar
is \DebugBar\Debuger
Open
static::$debugBar = $debugbar;
- Exclude checks
Call to undeclared method \App\Debug\DebugBar\DebugBar::addCollector
Open
$debugbar->addCollector(new DataCollector\RequestDataCollector());
- Exclude checks
Property \App\Debuger::$debugBar
has undeclared type \DebugBar\Debuger
(Did you mean class \App\Debuger) Open
protected static $debugBar;
- Exclude checks
Call to undeclared method \App\Debug\DebugBar\DebugBar::addCollector
Open
$debugbar->addCollector(new DataCollector\MemoryCollector());
- Exclude checks
Call to method __construct
from undeclared class \DebugBar\DataCollector\timedatacollector
Open
$debugbar->addCollector(new DataCollector\TimeDataCollector());
- Exclude checks
Returning type \DebugBar\Debuger
but getDebugBar()
is declared to return \App\Debug\DebugBar\DebugBar
Open
return static::$debugBar;
- Exclude checks
Suspicious array access to \DebugBar\Debuger
Open
static::$debugBar['logs']->addMessage($message, $level, $traces);
- Exclude checks
Call to method __construct
from undeclared class \DebugBar\DataCollector\exceptionscollector
Open
$debugbar->addCollector(new DataCollector\ExceptionsCollector());
- Exclude checks
Call to undeclared method \App\Debug\DebugBar\DebugBar::addCollector
Open
$debugbar->addCollector(new \DebugBar\DataCollector\ConfigCollector([
- Exclude checks
Method \App\Debuger::initConsole
is declared to return \App\DebugBar\Debuger
but has no return value Open
public static function initConsole()
- Exclude checks
Avoid variables with short names like $l. Configured minimum length is 3. Open
$l = $k - $minLevel;
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $a. Configured minimum length is 3. Open
foreach ($arg as &$a) {
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Spaces must be used to indent lines; tabs are not allowed Open
$debugbar->addCollector(new Debug\DebugBarLogs());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$debugbar->addCollector(new \DebugBar\DataCollector\ConfigCollector([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Checking is active debugging.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$debugBar = $debugbar;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$target = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function addLogs($message, $level, $traces)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Config::debug('LOG_TO_FILE')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Line exceeds 120 characters; contains 166 characters Open
if (false === $ips || (\is_string($ips) && RequestUtil::getRemoteIP(true) === $ips) || (\is_array($ips) && \in_array(RequestUtil::getRemoteIP(true), $ips))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($v['args'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($v['args'] as &$arg) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$val .= '(' . \get_class($a) . ')';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$trace .= "$sep$l";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($args, $val, $v, $k, $a);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return rtrim(str_replace(ROOT_DIRECTORY . \DIRECTORY_SEPARATOR, '', $trace), PHP_EOL);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'relation' => \App\Config::relation(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return static::$debugBar;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function consoleIsActive()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $maxLevel
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$debugbar->addCollector(new DataCollector\RequestDataCollector());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Config::debug('DISPLAY_LOGS_IN_CONSOLE')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'performance' => \App\Config::performance(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\Config\Debug::$DEBUG_CONSOLE_ALLOWED_USERS && !\in_array(\App\User::getCurrentUserRealId(), \Config\Debug::$DEBUG_CONSOLE_ALLOWED_USERS)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($k < $minLevel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$val = $a;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\is_array($a) || \is_object($a) || \is_resource($a)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($v['line'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function isDebugBar()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset(static::$debugBar['logs'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false === $ips || (\is_string($ips) && RequestUtil::getRemoteIP(true) === $ips) || (\is_array($ips) && \in_array(RequestUtil::getRemoteIP(true), $ips))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Generates a backtrace.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (debug_backtrace() as $k => $v) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$args = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$args .= $val . ',';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$trace .= " {$v['file']}:{$v['line']}";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Initiating debugging console.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function initConsole()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$debugbar->addCollector(new DataCollector\ExceptionsCollector());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'debug' => \App\Config::debug(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return \App\Debug\DebugBar\DebugBar
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (\is_array($arg)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'developer' => \App\Config::developer(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return isset(static::$debugBar);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false !== $levels) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$target['levels'] = $levels;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Config::debug('LOG_TO_PROFILE')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $minLevel
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$trace .= ' >> ' . (isset($v['class']) ? $v['class'] . '->' : '') . "{$v['function']}($args)" . PHP_EOL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$debugbar->addCollector(new DataCollector\MemoryCollector());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$debugBar['logs']->addMessage($message, $level, $traces);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'class' => 'yii\log\Dispatcher',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
continue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$args = rtrim($args, ',');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getDebugBar()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function init()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false !== $levels) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ips = \Config\Debug::$DEBUG_CONSOLE_ALLOWED_IPS;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\is_object($a)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (0 !== $maxLevel && $l >= $maxLevel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'traceLevel' => \App\Config::debug('LOG_TRACE_LEVEL'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getBacktrace($minLevel = 1, $maxLevel = 0, $sep = '#')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\is_array($arg) && !\is_object($arg) && !\is_resource($arg)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 156 characters Open
if (\Config\Debug::$DEBUG_CONSOLE_ALLOWED_USERS && !\in_array(\App\User::getCurrentUserRealId(), \Config\Debug::$DEBUG_CONSOLE_ALLOWED_USERS)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$targets['file'] = $target;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\Yii::createObject([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Checking console is active.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$args .= var_export($arg, true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get Debuger instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Initiating debugging.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$targets = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$levels = \App\Config::debug('LOG_LEVELS');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$args = rtrim($args, ',') . ']';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected static $debugBar;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return \App\DebugBar\Debuger
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Config::debug('DISPLAY_CONFIG_IN_CONSOLE')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'api' => \App\Config::api(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'class' => 'App\Log\Profiling',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$targets['profiling'] = $target;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$val = \gettype($a);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var \DebugBar\Debuger
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$debugbar->addCollector(new DataCollector\PhpInfoCollector());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$debugbar->addCollector(new DataCollector\TimeDataCollector());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'security' => \App\Config::security(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$levels = \App\Config::debug('LOG_LEVELS');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$target = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'targets' => $targets,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$trace = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Config::debug('DISPLAY_DEBUG_CONSOLE') && static::consoleIsActive()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'search' => \App\Config::search(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sounds' => \App\Config::sounds(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'class' => 'App\Log\FileTarget',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$debugbar = new Debug\DebugBar\DebugBar();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$target['levels'] = $levels;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$args .= '[';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $sep
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$l = $k - $minLevel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($arg as &$a) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$args .= ',';
- Exclude checks