getContextMessage accesses the super-global variable $GLOBALS. Open
protected function getContextMessage()
{
if (ROOT_DIRECTORY !== getcwd()) {
chdir(ROOT_DIRECTORY);
}
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
Function getContextMessage
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function getContextMessage()
{
if (ROOT_DIRECTORY !== getcwd()) {
chdir(ROOT_DIRECTORY);
}
- 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 getContextMessage
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getContextMessage()
{
if (ROOT_DIRECTORY !== getcwd()) {
chdir(ROOT_DIRECTORY);
}
Function formatMessage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function formatMessage($message)
{
[$text, $level, $category, $timestamp] = $message;
$level = \yii\log\Logger::getLevelName($level);
if (!\is_string($text)) {
- 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 export
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function export()
{
$text = implode("\n", array_map([$this, 'formatMessage'], $this->messages));
if (false === ($fp = fopen($this->logFile, 'a'))) {
throw new InvalidConfigException("Unable to append to log file: {$this->logFile}");
- 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 '135', column '24'). Open
$anonymization = new \App\Anonymization();
- 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 '\Yii' in method 'init'. Open
$this->logFile = Yii::getAlias($this->logFile);
- 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\Utils' in method 'getContextMessage'. Open
$result .= "\n\${$key} = " . \App\Utils::varExport($anonymization->setData($value)->anonymize()->getData());
- 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 init uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->logFile = Yii::getAlias($this->logFile);
}
- 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\Utils\ConfReport' in method 'getContextMessage'. Open
foreach (\App\Utils\ConfReport::getAllErrors(true) as $key => $value) {
- 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 assigning values to variables in if clauses and the like (line '65', column '18'). Open
public function export()
{
$text = implode("\n", array_map([$this, 'formatMessage'], $this->messages));
if (false === ($fp = fopen($this->logFile, 'a'))) {
throw new InvalidConfigException("Unable to append to log file: {$this->logFile}");
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class '\App\Utils' in method 'getContextMessage'. Open
$result .= "\n_HEADERS = " . \App\Utils::varExport(getallheaders());
- 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 export uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
fwrite($fp, $text);
flock($fp, LOCK_UN);
fclose($fp);
}
- 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 formatMessage uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$text = \yii\helpers\VarDumper::export($text);
}
- 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\Utils' in method 'getContextMessage'. Open
$result .= "\n\${$key} = " . \App\Utils::varExport($value);
- 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\helpers\ArrayHelper' in method 'getContextMessage'. Open
foreach (\yii\helpers\ArrayHelper::filter($GLOBALS, $this->logVars) as $key => $value) {
- 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\helpers\VarDumper' in method 'formatMessage'. Open
$text = \yii\helpers\VarDumper::export($text);
- 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 'formatMessage'. Open
$level = \yii\log\Logger::getLevelName($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 'getContextMessage'. Open
if ('test' !== \App\Config::main('systemMode')) {
- 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
Call to undeclared method \App\Log\FileTarget::rotateFiles
Open
$this->rotateFiles();
- Exclude checks
Reference to undeclared property \App\Log\FileTarget->logFile
Open
$this->logFile = Yii::getAlias($this->logFile);
- Exclude checks
Call to method getLevelName
from undeclared class \yii\log\Logger
Open
$level = \yii\log\Logger::getLevelName($level);
- Exclude checks
Reference to undeclared property \App\Log\FileTarget->maxLogFiles
Open
if ($this->maxLogFiles < 1) {
- Exclude checks
Call to method filter
from undeclared class \yii\helpers\ArrayHelper
Open
foreach (\yii\helpers\ArrayHelper::filter($GLOBALS, $this->logVars) as $key => $value) {
- Exclude checks
Call to method getAllErrors
from undeclared class \App\Utils\ConfReport
(Did you mean class \Tests\Settings\ConfReport) Open
foreach (\App\Utils\ConfReport::getAllErrors(true) as $key => $value) {
- Exclude checks
Reference to undeclared property \App\Log\FileTarget->maxFileSize
Open
if ($this->maxFileSize < 1) {
- Exclude checks
Reference to undeclared property \App\Log\FileTarget->fileMode
Open
if (null !== $this->fileMode) {
- Exclude checks
Class extends undeclared class \yii\log\FileTarget
Open
class FileTarget extends \yii\log\FileTarget
- Exclude checks
Reference to undeclared property \App\Log\FileTarget->logFile
Open
if (null === $this->logFile) {
- Exclude checks
Static call to undeclared method \Yii::getAlias
Open
$this->logFile = Yii::getAlias($this->logFile);
- Exclude checks
Reference to undeclared property \App\Log\FileTarget->logFile
Open
file_put_contents($this->logFile, $text, FILE_APPEND | LOCK_EX);
- Exclude checks
Reference to undeclared property \App\Log\FileTarget->logFile
Open
$this->logFile = ROOT_DIRECTORY . '/cache/logs/system.log';
- Exclude checks
Reference to undeclared property \App\Log\FileTarget->maxLogFiles
Open
$this->maxLogFiles = 1;
- Exclude checks
@throws type of export
has undeclared type \yii\base\InvalidConfigException
Open
public function export()
- Exclude checks
Reference to undeclared property \App\Log\FileTarget->messages
Open
$text = implode("\n", array_map([$this, 'formatMessage'], $this->messages));
- Exclude checks
Reference to undeclared property \App\Log\FileTarget->logFile
Open
if (false === ($fp = fopen($this->logFile, 'a'))) {
- Exclude checks
Reference to undeclared property \App\Log\FileTarget->logFile
Open
if ($this->enableRotation && filesize($this->logFile) > $this->maxFileSize * 1024) {
- Exclude checks
Reference to undeclared property \App\Log\FileTarget->maxFileSize
Open
if ($this->enableRotation && filesize($this->logFile) > $this->maxFileSize * 1024) {
- Exclude checks
Call to method __construct
from undeclared class \yii\base\InvalidConfigException
Open
throw new InvalidConfigException("Unable to append to log file: {$this->logFile}");
- Exclude checks
Call to method export
from undeclared class \yii\helpers\VarDumper
Open
$text = \yii\helpers\VarDumper::export($text);
- Exclude checks
Reference to undeclared property \App\Log\FileTarget->maxFileSize
Open
$this->maxFileSize = 1;
- Exclude checks
Reference to undeclared property \App\Log\FileTarget->logFile
Open
throw new InvalidConfigException("Unable to append to log file: {$this->logFile}");
- Exclude checks
Reference to undeclared property \App\Log\FileTarget->fileMode
Open
chmod($this->logFile, $this->fileMode);
- Exclude checks
Reference to undeclared property \App\Log\FileTarget->logFile
Open
chmod($this->logFile, $this->fileMode);
- Exclude checks
Avoid variables with short names like $fp. Configured minimum length is 3. Open
if (false === ($fp = fopen($this->logFile, '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
* Log rotation is enabled by default. This property allows you to disable it, when you have configured
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array list of the PHP predefined variables that should be logged in a message.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $logVars = ['_GET', '_POST', '_FILES', '_COOKIE', '_SESSION'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function export()
- 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 array $message the log message to be formatted.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$level = \yii\log\Logger::getLevelName($level);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// exceptions may not be serializable if in the call stack somewhere is a Closure
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Initializes the route.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->maxLogFiles < 1) {
- 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
* Writes log messages to a file.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
fwrite($fp, $text);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (null !== $this->fileMode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result .= "\nError while saving logs: 'GLOBALS': \n" . $th->__toString();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->maxFileSize < 1) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->maxFileSize = 1;
- 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
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result .= 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
* @throws InvalidConfigException if unable to open the log file for writing
- 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 date('Y-m-d H:i:s', (int) $timestamp) . ".{$micro} [$level][$category] - $text"
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$anonymization = new \App\Anonymization();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('test' !== \App\Config::main('systemMode')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Note that a variable must be accessible via `$GLOBALS`. Otherwise it won't be logged
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (null === $this->logFile) {
- 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
throw new InvalidConfigException("Unable to append to log file: {$this->logFile}");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
fclose($fp);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
fclose($fp);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Formats a log message for display as a string.
- 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
. (empty($traces) ? '' : "\n" . $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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// clear stat cache to ensure getting the real current file size and not a cached one
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->rotateFiles();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($text instanceof \Throwable || $text instanceof \Exception) {
- 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
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string the context information. If an empty string, it means no context information
- 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
$result .= "\n_HEADERS = " . \App\Utils::varExport(getallheaders());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result .= "\n\${$key} = " . \App\Utils::varExport($value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $th) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* This method is invoked after the route is created by the route manager.
- 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
$this->maxLogFiles = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false === ($fp = fopen($this->logFile, 'a'))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
flock($fp, LOCK_UN);
- 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
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$category = '[' . $category . ']';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected function getContextMessage()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (\App\Utils\ConfReport::getAllErrors(true) as $key => $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var bool whether log files should be rotated when they reach a certain [[maxFileSize|maximum size]].
- 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
$this->logFile = Yii::getAlias($this->logFile);
- 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 (ROOT_DIRECTORY !== getcwd()) {
- 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
$result = '';
- 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
* @since 2.0.3
- 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
file_put_contents($this->logFile, $text, FILE_APPEND | LOCK_EX);
- 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 message structure follows that in [[Logger::messages]]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function formatMessage($message)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\is_string($text)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$text = (string) $text;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (\yii\helpers\ArrayHelper::filter($GLOBALS, $this->logVars) as $key => $value) {
- Exclude checks
Line exceeds 120 characters; contains 162 characters Open
return $result . "====================================================================================================================================\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logFile = ROOT_DIRECTORY . '/cache/logs/system.log';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
flock($fp, LOCK_EX);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// this may result in rotating twice when cached file size is used on subsequent calls
- 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
} catch (\Throwable $th) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result .= "\nError while saving logs: 'ConfReport::getAllErrors': \n" . $th->__toString();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$traces = $message[4];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$micro = explode('.', $timestamp);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Generates the context information 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
*
- 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($message[4])) {
- 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
flock($fp, LOCK_UN);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
chmod($this->logFile, $this->fileMode);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string the formatted message
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
[$text, $level, $category, $timestamp] = $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
* an external tools for log rotation on your server
- 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
if ($this->enableRotation) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->enableRotation && filesize($this->logFile) > $this->maxFileSize * 1024) {
- 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
$text = \yii\helpers\VarDumper::export($text);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result .= "\n\${$key} = " . \App\Utils::varExport($anonymization->setData($value)->anonymize()->getData());
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
$result .= "\n\${$key} = " . \App\Utils::varExport($anonymization->setData($value)->anonymize()->getData());
- 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 $enableRotation = false;
- 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
$text = implode("\n", array_map([$this, 'formatMessage'], $this->messages));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
clearstatcache();
- 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
$micro = end($micro);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* The default implementation will dump user information, system variables, etc.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
chdir(ROOT_DIRECTORY);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $result . "====================================================================================================================================\n";
- Exclude checks