File Log.php
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Logger files.
*
* @package App
Function setLevels
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function setLevels($levels)
{
if (\is_array($levels)) {
foreach ($levels as $level) {
if (isset(self::$levelMap[$level])) {
- 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 getlastLogs
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function getlastLogs($types = false)
{
$content = '';
$i = 0;
foreach (\Yii::getLogger()->messages as $message) {
- 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 '358', column '17'). Open
$query = (new \App\Db\Query())->from('o_#__' . $type);
- 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
The method getlastLogs has a boolean flag argument $types, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getlastLogs($types = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method getLogs has a boolean flag argument $countMode, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getLogs($type, $mode, $countMode = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Avoid using static access to class 'App\Debuger' in method 'log'. Open
$traces = Debuger::getBacktrace(2, $this->traceLevel, ' - ');
- 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
The method getLogs uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$query->limit(100);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'App\Debuger' in method 'log'. Open
Debuger::addLogs($message, self::getLevelName($level), $traces);
- 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\Db' in method 'getLogs'. Open
$db = \App\Db::getInstance('log');
- 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\log\Logger' in method 'getlastLogs'. Open
$level = \yii\log\Logger::getLevelName($message[1]);
- 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
The method setLevels uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
throw new Exceptions\AppException("Unrecognized level: $level");
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method setLevels uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$bitmapValues = array_reduce(self::$levelMap, fn ($carry, $item) => $carry | $item);
if (!($bitmapValues & $levels) && 0 !== $levels) {
throw new Exceptions\AppException("Incorrect $levels value");
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ',' or ')'
Open
$bitmapValues = array_reduce(self::$levelMap, fn ($carry, $item) => $carry | $item);
- Exclude checks
Similar blocks of code found in 3 locations. Consider refactoring. Open
'profile' => [
'label' => 'LBL_PROFILING',
'labelModule' => 'Settings:Log',
'table' => 'l_#__profile',
'icon' => 'fas fa-stopwatch',
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 143.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
'magento' => [
'label' => 'LBL_MAGENTO',
'labelModule' => 'Settings:Magento',
'table' => 'l_#__magento',
'icon' => 'yfi-magento',
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 143.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
'wapro' => [
'label' => 'LBL_WAPRO_ERP',
'labelModule' => 'Settings:Wapro',
'table' => 'l_#__wapro',
'icon' => 'fab fa-connectdevelop',
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 143.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
'batchMethod' => [
'label' => 'LBL_BATCH_METHODS',
'labelModule' => 'Settings:CronTasks',
'table' => 'l_#__batchmethod',
'icon' => 'fas fa-swatchbook',
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 138.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
'mail' => [
'label' => 'LBL_MAILS_NOT_SENT',
'labelModule' => 'Settings:Log',
'table' => 'l_#__mail',
'icon' => 'adminIcon-mail-queue',
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 138.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Avoid excessively long variable names like $logsViewerColumnMapping. Keep variable name length under 20. Open
public static $logsViewerColumnMapping = [
'magento' => [
'label' => 'LBL_MAGENTO',
'labelModule' => 'Settings:Magento',
'table' => 'l_#__magento',
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid variables with short names like $i. Configured minimum length is 3. Open
$i = 0;
- 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 $db. Configured minimum length is 3. Open
$db = \App\Db::getInstance('log');
- 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
/**
- 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
'time' => 'DateTimeRange',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'icon' => 'yfi-users',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'status' => ['type' => 'Text', 'label' => 'LBL_STATUS'],
- 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
* Column mapping by table for logs owasp.
- 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
'label' => 'LBL_WAPRO_ERP',
- 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
'access_for_user' => ['date', 'username', 'ip', 'module', 'url', 'agent', 'request', 'referer'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'magento' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'message' => ['type' => 'Text', 'label' => 'LBL_MESSAGE'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'code' => ['type' => 'Text', 'label' => 'LBL_CODE'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'columns' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'switchUsers' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'agent' => 'Text',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'LBL_MAGENTO',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'trace' => 'Text',
- 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
'dusername' => 'Text',
- 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 $logToLevels = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'time' => ['type' => 'DateTime', 'label' => 'LBL_TIME'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'time' => 'DateTimeRange',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'message' => 'Text',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'busername' => ['type' => 'Text', 'label' => 'LBL_BASE_USER'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'access_for_admin' => ['date', 'username', 'ip', 'module', 'url', 'agent', 'request', 'referer'],
- 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
'date' => 'DateTimeRange',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'csrf' => ['date', 'username', 'ip', 'referer', 'url', 'agent'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'labelModule' => 'Settings:Wapro',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'error' => ['type' => 'Text', 'label' => 'LBL_CODE'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'code' => 'Text',
- 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
'columns' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'date' => ['type' => 'DateTime', 'label' => 'LBL_TIME'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'agent' => ['type' => 'Text', 'label' => 'LBL_USER_AGENT'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'labelModule' => 'Settings:CronTasks',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'columns' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'code' => 'Text',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'trace' => 'Text',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $logToFile;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'wapro' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $logToProfile;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'table' => 'l_#__magento',
- 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
'category' => ['type' => 'Text', 'label' => 'LBL_CATEGORY'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'busername' => 'Text',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $owaspColumnMapping = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Column mapping by table for logs viewer.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'category' => 'Text',
- 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
'labelModule' => 'Settings:Magento',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'time' => ['type' => 'DateTime', 'label' => 'LBL_TIME'],
- 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
'filter' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'labelModule' => 'Settings:Users',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ip' => 'Text',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'access_for_api' => ['date', 'username', 'ip', 'url', 'agent', 'request'],
- 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
'filter' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'access_to_record' => ['date', 'username', 'ip', 'module', 'record', 'url', 'agent', 'request', 'referer'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $logsViewerColumnMapping = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'icon' => 'yfi-magento',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'category' => ['type' => 'Text', 'label' => 'LBL_CATEGORY'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'category' => 'Text',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'table' => 'l_#__wapro',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'LBL_SWITCH_USERS',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $logToConsole;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'trace' => ['type' => 'Text', 'label' => 'LBL_BACKTRACE'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'message' => 'Text',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'message' => ['type' => 'Text', 'label' => 'LBL_MESSAGE'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'trace' => ['type' => 'Text', 'label' => 'LBL_BACKTRACE'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'table' => 'l_#__switch_users',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'dusername' => ['type' => 'Text', 'label' => 'LBL_DEST_USER'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'LBL_BATCH_METHODS',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'filter' => [
- 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
'icon' => 'fab fa-connectdevelop',
- 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
'ip' => ['type' => 'Text', 'label' => 'LBL_IP_ADDRESS'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'batchMethod' => [
- 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
}
- 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 trace($message, $category = '')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $category the category of the message
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'icon' => 'fas fa-swatchbook',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'from' => 'Text',
- 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
$bitmapValues = array_reduce(self::$levelMap, fn ($carry, $item) => $carry | $item);
- 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 $category the category of the message
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'columns' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $levelMap = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\is_array($levels)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logToLevels |= self::$levelMap[$level];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $level the level of the message. This must be one of the following:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->traceLevel) {
- 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 (static::$logToFile) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Logs an informative message.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'params' => 'Text',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'labelModule' => 'Settings:Log',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'trace' => ['type' => 'Text', 'label' => 'LBL_BACKTRACE'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'duration' => ['type' => 'Text', 'label' => 'LBL_DURATION'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'profile' => Logger::LEVEL_PROFILE,
- 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;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\Yii::getLogger()->log($message, Logger::LEVEL_TRACE, $category);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'labelModule' => 'Settings:Log',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'LBL_MAILS_NOT_SENT',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'info' => Logger::LEVEL_INFO,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'log_time' => ['type' => 'Text', 'label' => 'LBL_TIME'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'duration' => 'Text',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function init()
- 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
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Sets the message levels that this target is interested in.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new Exceptions\AppException("Incorrect $levels value");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logToLevels = $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
if (static::$logToConsole) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Logs a message with the given type and category.
- 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
* complex data structure that will be handled by a [[Target|log 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
'table' => 'l_#__batchmethod',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'columns' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'filter' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'to' => 'Text',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'category' => 'Text',
- 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
'error' => Logger::LEVEL_ERROR,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'warning' => Logger::LEVEL_WARNING,
- 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
parent::init();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\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
foreach ($levels as $level) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!($bitmapValues & $levels) && 0 !== $levels) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (0 !== $this->logToLevels && !($this->logToLevels & $level)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->flush();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function info($message, $category = '')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'columns' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'subject' => ['type' => 'Text', 'label' => 'LBL_SUBJECT'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'table' => 'l_#__profile',
- 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' => Logger::LEVEL_TRACE,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Initializes the logger by registering [[flush()]] as a shutdown function.
- 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 function log($message, $level, $category = '')
- 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
'date' => ['type' => 'DateTime', 'label' => 'LBL_TIME'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'method' => ['type' => 'Text', 'label' => 'LBL_BATCH_NAME'],
- 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
'filter' => [
- 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 [[traceLevel]] is greater than 0, additional call stack information about
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $category the category of the message
- 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
'message' => ['type' => 'Text', 'label' => 'LBL_ERROR_MASAGE'],
- 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
'owner' => ['type' => 'Owner', 'label' => 'LBL_OWNER'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'subject' => 'Text',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'profile' => [
- 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 array|int $levels message levels that this target is interested in.
- 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
* An informative message is typically logged by an application to keep record of
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'from' => ['type' => 'Text', 'label' => 'LBL_FROM'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'category' => ['type' => 'Text', 'label' => 'Category'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'subinfoject' => 'Text',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setLevels(\Config\Debug::$LOG_LEVELS);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* the application code will be logged as well.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array|string $message the message to be logged. This can be a simple string or a more
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* `Logger::LEVEL_ERROR`, `Logger::LEVEL_WARNING`, `Logger::LEVEL_INFO`, `Logger::LEVEL_TRACE`,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$traces = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Debuger::addLogs($message, self::getLevelName($level), $traces);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Trace messages are logged mainly for development purpose to see
- 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
'userid' => ['type' => 'Owner', 'label' => 'LBL_OWNER'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'icon' => 'adminIcon-mail-queue',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'info' => ['type' => 'Text', 'label' => 'LBL_PARAMS'],
- 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 function setLevels($levels)
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
* `Logger::LEVEL_ERROR`, `Logger::LEVEL_WARNING`, `Logger::LEVEL_INFO`, `Logger::LEVEL_TRACE`,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->flushInterval > 0 && \count($this->messages) >= $this->flushInterval) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Logs a trace message.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $message the message to be logged
- 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
'date' => 'DateTimeRange',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'mail' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'log_time' => 'Text',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset(self::$levelMap[$level])) {
- 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
* the execution work flow of some code.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'filter' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'icon' => 'fas fa-stopwatch',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new Exceptions\AppException("Unrecognized level: $level");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->messages[] = [$message, $level, $category, microtime(true), $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
* @param string $message the message to be logged
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'table' => 'l_#__mail',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'date' => ['type' => 'DateTime', 'label' => 'LBL_TIME'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'to' => ['type' => 'Text', 'label' => 'LBL_TO'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'date' => 'DateTimeRange',
- 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
* `Logger::LEVEL_PROFILE_BEGIN`, `Logger::LEVEL_PROFILE_END`
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'params' => ['type' => 'Text', 'label' => 'LBL_PARAMS'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'method' => 'Text',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'message' => 'Text',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'LBL_PROFILING',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'trace' => 'Text',
- 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
$traces = Debuger::getBacktrace(2, $this->traceLevel, ' - ');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* something important (e.g. an administrator logs in).
- 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
* A warning message is typically logged when an error occurs while the execution
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* This has to be matched with a previous call to [[beginProfile]] with the same category name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @see beginProfile()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($categories && !\in_array($category, $categories)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- 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
return $content;
- 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 $message the message to be logged
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (static::$logToFile) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\Yii::getLogger()->log($message, Logger::LEVEL_ERROR, $category);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* \Yii::beginProfile('block2');
- 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 $category the category of this log message
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $mode
- 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 ('oneDay' === $mode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $query->count('*', $db);
- 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 bool|string[] $types
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($category) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (static::$logToFile) {
- 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
* Marks the end of a code block for 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function warning($message, $category = '')
- 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
* ```php
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* \Yii::beginProfile('block1');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $category the category of this log message
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$content = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false !== $types && !\in_array($level, $types)) {
- 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 error($message, $category = '')
- 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;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = \App\Db::getInstance('log');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->where(['>=', 'date', date('Y-m-d H:i:s', strtotime('-1 day'))]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\Yii::getLogger()->log($message, Logger::LEVEL_INFO, $category);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (static::$logToFile) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\Yii::getLogger()->log($message, Logger::LEVEL_WARNING, $category);
- 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
* Marks the beginning of a code block for profiling.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* This has to be matched with a call to [[endProfile]] with the same category name.
- 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;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $category the category of the message
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* An error message is typically logged when an unrecoverable error occurs
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (static::$logToProfile) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $token token for the code block
- 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
return $query->all($db);
- 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
$i = 0;
- 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
* can still continue.
- 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 $category the category of the message
- 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
* The begin- and end- calls must also be properly nested. For example,.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @see endProfile()
- 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
$categories = \Config\Debug::$LOG_PROFILE_CATEGORIES ?? [];
- 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 ($categories && !\in_array($category, $categories)) {
- 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
$level = \yii\log\Logger::getLevelName($message[1]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (static::$logToProfile) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $type
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getLogs($type, $mode, $countMode = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$category = $message[2] ?: '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$content .= " {$message[0]}" . PHP_EOL;
- 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
$categories = \Config\Debug::$LOG_PROFILE_CATEGORIES ?? [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $countMode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->orderBy(['id' => SORT_DESC]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $message the message to be logged
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* // some code to be profiled
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $token token for the code block
- 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 (\Yii::getLogger()->messages as $message) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$content .= "#$i [$level]";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* // some other code to be profiled
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* \Yii::endProfile('block2');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* \Yii::endProfile('block1');
- 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
$query->limit(100);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$i;
- 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
* Logs an error message.
- 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
$query = (new \App\Db\Query())->from('o_#__' . $type);
- 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 ($countMode) {
- 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 getlastLogs($types = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* during the execution of an application.
- 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
\Yii::getLogger()->log($token, Logger::LEVEL_PROFILE_END, $category);
- 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 last logs.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$content .= "[$category]";
- 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
* Get user action 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
* Logs a warning message.
- 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 beginProfile($token, $category = '')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\Yii::getLogger()->log($token, Logger::LEVEL_PROFILE_BEGIN, $category);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function endProfile($token, $category = '')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Space before opening parenthesis of function call prohibited Open
$bitmapValues = array_reduce(self::$levelMap, fn ($carry, $item) => $carry | $item);
- Exclude checks