YetiForceCompany/YetiForceCRM

View on GitHub
app/Log/FileTarget.php

Summary

Maintainability
A
3 hrs
Test Coverage
D
69%

getContextMessage accesses the super-global variable $GLOBALS.
Open

    protected function getContextMessage()
    {
        if (ROOT_DIRECTORY !== getcwd()) {
            chdir(ROOT_DIRECTORY);
        }
Severity: Minor
Found in app/Log/FileTarget.php by phpmd

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);
        }
Severity: Minor
Found in app/Log/FileTarget.php - About 1 hr to fix

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);
        }
Severity: Minor
Found in app/Log/FileTarget.php - About 1 hr to fix

    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)) {
    Severity: Minor
    Found in app/Log/FileTarget.php - About 35 mins to fix

    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}");
    Severity: Minor
    Found in app/Log/FileTarget.php - About 25 mins to fix

    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();
    Severity: Minor
    Found in app/Log/FileTarget.php by phpmd

    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);
    Severity: Minor
    Found in app/Log/FileTarget.php by phpmd

    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());
    Severity: Minor
    Found in app/Log/FileTarget.php by phpmd

    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);
            }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpmd

    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) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpmd

    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}");
    Severity: Minor
    Found in app/Log/FileTarget.php by phpmd

    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());
    Severity: Minor
    Found in app/Log/FileTarget.php by phpmd

    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);
            }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpmd

    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);
                }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpmd

    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);
    Severity: Minor
    Found in app/Log/FileTarget.php by phpmd

    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) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpmd

    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);
    Severity: Minor
    Found in app/Log/FileTarget.php by phpmd

    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);
    Severity: Minor
    Found in app/Log/FileTarget.php by phpmd

    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')) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpmd

    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();
    Severity: Critical
    Found in app/Log/FileTarget.php by phan

    Reference to undeclared property \App\Log\FileTarget->logFile
    Open

                $this->logFile = Yii::getAlias($this->logFile);
    Severity: Minor
    Found in app/Log/FileTarget.php by phan

    Call to method getLevelName from undeclared class \yii\log\Logger
    Open

            $level = \yii\log\Logger::getLevelName($level);
    Severity: Critical
    Found in app/Log/FileTarget.php by phan

    Reference to undeclared property \App\Log\FileTarget->maxLogFiles
    Open

            if ($this->maxLogFiles < 1) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phan

    Call to method filter from undeclared class \yii\helpers\ArrayHelper
    Open

                foreach (\yii\helpers\ArrayHelper::filter($GLOBALS, $this->logVars) as $key => $value) {
    Severity: Critical
    Found in app/Log/FileTarget.php by phan

    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) {
    Severity: Critical
    Found in app/Log/FileTarget.php by phan

    Reference to undeclared property \App\Log\FileTarget->maxFileSize
    Open

            if ($this->maxFileSize < 1) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phan

    Reference to undeclared property \App\Log\FileTarget->fileMode
    Open

            if (null !== $this->fileMode) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phan

    Class extends undeclared class \yii\log\FileTarget
    Open

    class FileTarget extends \yii\log\FileTarget
    Severity: Critical
    Found in app/Log/FileTarget.php by phan

    Reference to undeclared property \App\Log\FileTarget->logFile
    Open

            if (null === $this->logFile) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phan

    Static call to undeclared method \Yii::getAlias
    Open

                $this->logFile = Yii::getAlias($this->logFile);
    Severity: Critical
    Found in app/Log/FileTarget.php by phan

    Reference to undeclared property \App\Log\FileTarget->logFile
    Open

                file_put_contents($this->logFile, $text, FILE_APPEND | LOCK_EX);
    Severity: Minor
    Found in app/Log/FileTarget.php by phan

    Reference to undeclared property \App\Log\FileTarget->logFile
    Open

                $this->logFile = ROOT_DIRECTORY . '/cache/logs/system.log';
    Severity: Minor
    Found in app/Log/FileTarget.php by phan

    Reference to undeclared property \App\Log\FileTarget->maxLogFiles
    Open

                $this->maxLogFiles = 1;
    Severity: Minor
    Found in app/Log/FileTarget.php by phan

    @throws type of export has undeclared type \yii\base\InvalidConfigException
    Open

        public function export()
    Severity: Minor
    Found in app/Log/FileTarget.php by phan

    Reference to undeclared property \App\Log\FileTarget->messages
    Open

            $text = implode("\n", array_map([$this, 'formatMessage'], $this->messages));
    Severity: Minor
    Found in app/Log/FileTarget.php by phan

    Reference to undeclared property \App\Log\FileTarget->logFile
    Open

            if (false === ($fp = fopen($this->logFile, 'a'))) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phan

    Reference to undeclared property \App\Log\FileTarget->logFile
    Open

            if ($this->enableRotation && filesize($this->logFile) > $this->maxFileSize * 1024) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phan

    Reference to undeclared property \App\Log\FileTarget->maxFileSize
    Open

            if ($this->enableRotation && filesize($this->logFile) > $this->maxFileSize * 1024) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phan

    Call to method __construct from undeclared class \yii\base\InvalidConfigException
    Open

                throw new InvalidConfigException("Unable to append to log file: {$this->logFile}");
    Severity: Critical
    Found in app/Log/FileTarget.php by phan

    Call to method export from undeclared class \yii\helpers\VarDumper
    Open

                    $text = \yii\helpers\VarDumper::export($text);
    Severity: Critical
    Found in app/Log/FileTarget.php by phan

    Reference to undeclared property \App\Log\FileTarget->maxFileSize
    Open

                $this->maxFileSize = 1;
    Severity: Minor
    Found in app/Log/FileTarget.php by phan

    Reference to undeclared property \App\Log\FileTarget->logFile
    Open

                throw new InvalidConfigException("Unable to append to log file: {$this->logFile}");
    Severity: Minor
    Found in app/Log/FileTarget.php by phan

    Reference to undeclared property \App\Log\FileTarget->fileMode
    Open

                chmod($this->logFile, $this->fileMode);
    Severity: Minor
    Found in app/Log/FileTarget.php by phan

    Reference to undeclared property \App\Log\FileTarget->logFile
    Open

                chmod($this->logFile, $this->fileMode);
    Severity: Minor
    Found in app/Log/FileTarget.php by phan

    Avoid variables with short names like $fp. Configured minimum length is 3.
    Open

            if (false === ($fp = fopen($this->logFile, 'a'))) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpmd

    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
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    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.
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public $logVars = ['_GET', '_POST', '_FILES', '_COOKIE', '_SESSION'];
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function export()
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param array $message the log message to be formatted.
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $level = \yii\log\Logger::getLevelName($level);
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    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
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Initializes the route.
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ($this->maxLogFiles < 1) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Writes log messages to a file.
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                fwrite($fp, $text);
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (null !== $this->fileMode) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $result .= "\nError while saving logs: 'GLOBALS': \n" . $th->__toString();
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ($this->maxFileSize < 1) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $this->maxFileSize = 1;
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            try {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $result .= PHP_EOL;
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @throws InvalidConfigException if unable to open the log file for writing
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    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"
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $anonymization = new \App\Anonymization();
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ('test' !== \App\Config::main('systemMode')) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    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
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (null === $this->logFile) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                throw new InvalidConfigException("Unable to append to log file: {$this->logFile}");
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                fclose($fp);
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                fclose($fp);
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Formats a log message for display as a string.
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ('' !== $category) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                . (empty($traces) ? '' : "\n" . $traces);
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    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
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $this->rotateFiles();
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                if ($text instanceof \Throwable || $text instanceof \Exception) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $traces = '';
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    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
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $result .= "\n_HEADERS = " . \App\Utils::varExport(getallheaders());
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                        $result .= "\n\${$key} = " . \App\Utils::varExport($value);
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                } catch (\Throwable $th) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    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.
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $this->maxLogFiles = 1;
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (false === ($fp = fopen($this->logFile, 'a'))) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                flock($fp, LOCK_UN);
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            } else {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                } else {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $category = '[' . $category . ']';
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        protected function getContextMessage()
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    foreach (\App\Utils\ConfReport::getAllErrors(true) as $key => $value) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    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]].
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $this->logFile = Yii::getAlias($this->logFile);
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (ROOT_DIRECTORY !== getcwd()) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $result = '';
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @since 2.0.3
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function init()
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                file_put_contents($this->logFile, $text, FILE_APPEND | LOCK_EX);
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *                       The message structure follows that in [[Logger::messages]]
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function formatMessage($message)
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (!\is_string($text)) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $text = (string) $text;
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                foreach (\yii\helpers\ArrayHelper::filter($GLOBALS, $this->logVars) as $key => $value) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Line exceeds 120 characters; contains 162 characters
    Open

            return $result . "====================================================================================================================================\n";
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $this->logFile = ROOT_DIRECTORY . '/cache/logs/system.log';
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            flock($fp, LOCK_EX);
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    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
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            } catch (\Throwable $th) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                try {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $result .= "\nError while saving logs: 'ConfReport::getAllErrors': \n" . $th->__toString();
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $traces = $message[4];
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $micro = explode('.', $timestamp);
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Generates the context information to be logged.
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (isset($message[4])) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                flock($fp, LOCK_UN);
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                chmod($this->logFile, $this->fileMode);
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return string the formatted message
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            [$text, $level, $category, $timestamp] = $message;
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *           an external tools for log rotation on your server
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            } else {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ($this->enableRotation) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ($this->enableRotation && filesize($this->logFile) > $this->maxFileSize * 1024) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $text = \yii\helpers\VarDumper::export($text);
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                        $result .= "\n\${$key} = " . \App\Utils::varExport($anonymization->setData($value)->anonymize()->getData());
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Line exceeds 120 characters; contains 128 characters
    Open

                        $result .= "\n\${$key} = " . \App\Utils::varExport($anonymization->setData($value)->anonymize()->getData());
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public $enableRotation = false;
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $text = implode("\n", array_map([$this, 'formatMessage'], $this->messages));
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                clearstatcache();
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $micro = end($micro);
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * The default implementation will dump user information, system variables, etc.
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                chdir(ROOT_DIRECTORY);
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    if ($value) {
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $result . "====================================================================================================================================\n";
    Severity: Minor
    Found in app/Log/FileTarget.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status