YetiForceCompany/YetiForceCRM

View on GitHub
app/Session/File.php

Summary

Maintainability
A
2 hrs
Test Coverage
F
13%

Function clean has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public static function clean()
    {
        $time = microtime(true);
        $lifeTime = \Config\Security::$maxLifetimeSession;
        $exclusion = ['.htaccess', 'index.html', 'sess_' . session_id()];
Severity: Minor
Found in app/Session/File.php - About 2 hrs 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

The method clean() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
Open

    public static function clean()
    {
        $time = microtime(true);
        $lifeTime = \Config\Security::$maxLifetimeSession;
        $exclusion = ['.htaccess', 'index.html', 'sess_' . session_id()];
Severity: Minor
Found in app/Session/File.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

Refactor this function to reduce its Cognitive Complexity from 20 to the 15 allowed.
Open

    public static function clean()
Severity: Critical
Found in app/Session/File.php by sonar-php

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

Missing class import via use statement (line '46', column '16').
Open

        foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(\App\Session::SESSION_PATH, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
Severity: Minor
Found in app/Session/File.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

Missing class import via use statement (line '23', column '47').
Open

        foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(\App\Session::SESSION_PATH, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
Severity: Minor
Found in app/Session/File.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

Missing class import via use statement (line '46', column '47').
Open

        foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(\App\Session::SESSION_PATH, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
Severity: Minor
Found in app/Session/File.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

Missing class import via use statement (line '108', column '15').
Open

                throw new \App\Exceptions\IllegalValue('invalid data, remaining: ' . substr($session, $offset));
Severity: Minor
Found in app/Session/File.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

Missing class import via use statement (line '23', column '16').
Open

        foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(\App\Session::SESSION_PATH, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
Severity: Minor
Found in app/Session/File.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

Missing class import via use statement (line '89', column '15').
Open

                throw new \App\Exceptions\NotAllowedMethod('Unsupported session.serialize_handler: ' . $method . '. Supported: php, php_binary');
Severity: Minor
Found in app/Session/File.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 assigning values to variables in if clauses and the like (line '60', column '41').
Open

    public function getById(string $sessionId): array
    {
        $sessionFilePath = \App\Session::SESSION_PATH . \DIRECTORY_SEPARATOR . 'sess_' . $sessionId;
        $sessionData = [];
        if (file_exists($sessionFilePath) && ($content = file_get_contents($sessionFilePath))) {
Severity: Minor
Found in app/Session/File.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

Define a constant instead of duplicating this literal "baseUserId" 3 times.
Open

                if (!empty($sessionData['baseUserId']) || !empty($sessionData['authenticated_user_id'])) {
Severity: Critical
Found in app/Session/File.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "sess_" 3 times.
Open

        $exclusion = ['.htaccess', 'index.html', 'sess_' . session_id()];
Severity: Critical
Found in app/Session/File.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Call to method getUserModel from undeclared class \App\User (Did you mean class \Tests\App\User)
Open

                    $userName = \App\User::getUserModel($userId)->getDetail('user_name');
Severity: Critical
Found in app/Session/File.php by phan

Remove the code after this "return".
Open

                return self::unserializePhp($session);
Severity: Major
Found in app/Session/File.php by sonar-php

Jump statements (return, break, continue, and goto) and throw expressions move control flow out of the current code block. Typically, any statements in a block that come after a jump or throw are simply wasted keystrokes lying in wait to confuse the unwary.

Rarely, as illustrated below, code after a jump or throw is reachable. However, such code is difficult to understand, and should be refactored.

Noncompliant Code Example

function fun($a) {
  $i = 10;
  return $i + $a;
  $i++;             // this is never executed
}

function foo($a) {
  if ($a == 5) {
    goto error;
  } else {
    // do the job
  }
  return;

  error:
    printf("don't use 5"); // this is reachable but unreadable

}

Compliant Solution

function fun($a) {
  $i = 10;
  return $i + $a;
}

function foo($a) {
  if ($a == 5) {
    handleError();
  } else {
    // do the job
  }
  return;
}

See

  • MISRA C:2004, 14.1 - There shall be no unreachable code
  • MISRA C++:2008, 0-1-1 - A project shall not contain unreachable code
  • MISRA C++:2008, 0-1-9 - There shall be no dead code
  • MISRA C:2012, 2.1 - A project shall not contain unreachable code
  • MISRA C:2012, 2.2 - There shall be no dead code
  • MITRE, CWE-561 - Dead Code
  • CERT, MSC56-J. - Detect and remove superfluous code and values
  • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
  • CERT, MSC07-CPP. - Detect and remove dead code

Remove the code after this "return".
Open

                return self::unserializePhpBinary($session);
Severity: Major
Found in app/Session/File.php by sonar-php

Jump statements (return, break, continue, and goto) and throw expressions move control flow out of the current code block. Typically, any statements in a block that come after a jump or throw are simply wasted keystrokes lying in wait to confuse the unwary.

Rarely, as illustrated below, code after a jump or throw is reachable. However, such code is difficult to understand, and should be refactored.

Noncompliant Code Example

function fun($a) {
  $i = 10;
  return $i + $a;
  $i++;             // this is never executed
}

function foo($a) {
  if ($a == 5) {
    goto error;
  } else {
    // do the job
  }
  return;

  error:
    printf("don't use 5"); // this is reachable but unreadable

}

Compliant Solution

function fun($a) {
  $i = 10;
  return $i + $a;
}

function foo($a) {
  if ($a == 5) {
    handleError();
  } else {
    // do the job
  }
  return;
}

See

  • MISRA C:2004, 14.1 - There shall be no unreachable code
  • MISRA C++:2008, 0-1-1 - A project shall not contain unreachable code
  • MISRA C++:2008, 0-1-9 - There shall be no dead code
  • MISRA C:2012, 2.1 - A project shall not contain unreachable code
  • MISRA C:2012, 2.2 - There shall be no dead code
  • MITRE, CWE-561 - Dead Code
  • CERT, MSC56-J. - Detect and remove superfluous code and values
  • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
  • CERT, MSC07-CPP. - Detect and remove dead code

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

        $i = 0;
Severity: Minor
Found in app/Session/File.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

                unlink($item->getPathname());
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

                        yield $userId => $userName;
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

                }
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

Line exceeds 120 characters; contains 200 characters
Open

        foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(\App\Session::SESSION_PATH, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        $sessionData = [];
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

            $data = unserialize(substr($session, $offset), ['allowed_classes' => false]);
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

                if (!empty($sessionData['baseUserId']) || !empty($sessionData['authenticated_user_id'])) {
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

                ++$i;
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

    /** {@inheritdoc} */
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

            case 'php':
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(\App\Session::SESSION_PATH, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

            $sessionData = self::unserialize($content);
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        $method = ini_get('session.serialize_handler');
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     * @return array
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

            if (!strstr(substr($session, $offset), '|')) {
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

            $return[$varName] = $data;
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

Line exceeds 120 characters; contains 200 characters
Open

        foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(\App\Session::SESSION_PATH, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

            if ($item->isFile() && !\in_array($item->getBasename(), $exclusion)) {
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

                if (!empty($sessionData['last_activity']) && ($time - $sessionData['last_activity']) < $lifeTime) {
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

                    $userId = empty($sessionData['baseUserId']) ? $sessionData['authenticated_user_id'] : $sessionData['baseUserId'];
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

            }
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

                throw new \App\Exceptions\IllegalValue('invalid data, remaining: ' . substr($session, $offset));
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        $exclusion = ['.htaccess', 'index.html', 'sess_' . session_id()];
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        $i = 0;
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(\App\Session::SESSION_PATH, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     * @throws \App\Exceptions\NotAllowedMethod
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

                break;
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

            case 'php_binary':
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     * @throws \App\Exceptions\IllegalValue
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

            $pos = strpos($session, '|', $offset);
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        return $return;
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

                    continue;
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

Line exceeds 120 characters; contains 133 characters
Open

                    $userId = empty($sessionData['baseUserId']) ? $sessionData['authenticated_user_id'] : $sessionData['baseUserId'];
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        }
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        $sessionFilePath = \App\Session::SESSION_PATH . \DIRECTORY_SEPARATOR . 'sess_' . $sessionId;
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

    public static function unserialize(string $session)
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

            $offset += \strlen(serialize($data));
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     * @param string $session
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     * @throws \App\Exceptions\IllegalValue
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

                return self::unserializePhp($session);
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

                return self::unserializePhpBinary($session);
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

    private static function unserializePhp(string $session)
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

    public static function cleanAll(): int
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     * @return array
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

            $num = $pos - $offset;
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

            $varName = substr($session, $offset, $num);
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     * Deserialize session data from string php_binary handler method.
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

    public static function clean()
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        $time = microtime(true);
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

                    }
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        if (file_exists($sessionFilePath) && ($content = file_get_contents($sessionFilePath))) {
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        }
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     * Deserialize session data from string, entry function.
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        switch ($method) {
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

            default:
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     * Deserialize session data from string php handler method.
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     * @param string $session
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        return $i;
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

            }
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

    private static function unserializePhpBinary(string $session)
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

            $return[$varName] = $data;
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

                $sessionData = static::unserialize(file_get_contents($item->getPathname()));
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

                }
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

            }
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

                unlink($item->getPathname());
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

    public function getById(string $sessionId): array
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

Line exceeds 120 characters; contains 145 characters
Open

                throw new \App\Exceptions\NotAllowedMethod('Unsupported session.serialize_handler: ' . $method . '. Supported: php, php_binary');
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        while ($offset < \strlen($session)) {
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        }
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

            ++$offset;
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

            $data = unserialize(substr($session, $offset), ['allowed_classes' => false]);
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        $exclusion = ['.htaccess', 'index.html', 'sess_' . session_id()];
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        return $sessionData;
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     * @example http://php.net/manual/en/function.session-decode.php#108037
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

                break;
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

                throw new \App\Exceptions\NotAllowedMethod('Unsupported session.serialize_handler: ' . $method . '. Supported: php, php_binary');
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        $return = [];
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        $offset = 0;
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        $offset = 0;
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

    /** {@inheritdoc} */
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

    /** {@inheritdoc} */
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

            if ($item->isFile() && !\in_array($item->getBasename(), $exclusion)) {
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

            $varName = substr($session, $offset, $num);
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        $lifeTime = \Config\Security::$maxLifetimeSession;
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

                    $userName = \App\User::getUserModel($userId)->getDetail('user_name');
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

                    if (!empty($userName)) {
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        }
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        }
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

            $offset += $num + 1;
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        }
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     * @return array
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        $return = [];
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        return $return;
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

            $num = \ord($session[$offset]);
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

            $offset += $num;
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

            $offset += \strlen(serialize($data));
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     * @param string $session
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

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

        while ($offset < \strlen($session)) {
Severity: Minor
Found in app/Session/File.php by phpcodesniffer

There are no issues that match your filters.

Category
Status