yiisoft/yii2

View on GitHub
framework/web/Session.php

Summary

Maintainability
A
3 hrs
Test Coverage

get accesses the super-global variable $_SESSION.
Open

    public function get($key, $defaultValue = null)
    {
        $this->open();
        return isset($_SESSION[$key]) ? $_SESSION[$key] : $defaultValue;
    }
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

remove accesses the super-global variable $_SESSION.
Open

    public function remove($key)
    {
        $this->open();
        if (isset($_SESSION[$key])) {
            $value = $_SESSION[$key];
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

freeze accesses the super-global variable $_SESSION.
Open

    protected function freeze()
    {
        if ($this->getIsActive()) {
            if (isset($_SESSION)) {
                $this->frozenSessionData = $_SESSION;
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

unfreeze accesses the super-global variable $_SESSION.
Open

    protected function unfreeze()
    {
        if (null !== $this->frozenSessionData) {

            YII_DEBUG ? session_start() : @session_start();
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

getAllFlashes accesses the super-global variable $_SESSION.
Open

    public function getAllFlashes($delete = false)
    {
        $counters = $this->get($this->flashParam, []);
        $flashes = [];
        foreach (array_keys($counters) as $key) {
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

getAllFlashes accesses the super-global variable $_SESSION.
Open

    public function getAllFlashes($delete = false)
    {
        $counters = $this->get($this->flashParam, []);
        $flashes = [];
        foreach (array_keys($counters) as $key) {
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

setFlash accesses the super-global variable $_SESSION.
Open

    public function setFlash($key, $value = true, $removeAfterAccess = true)
    {
        $counters = $this->get($this->flashParam, []);
        $counters[$key] = $removeAfterAccess ? -1 : 0;
        $_SESSION[$key] = $value;
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

addFlash accesses the super-global variable $_SESSION.
Open

    public function addFlash($key, $value = true, $removeAfterAccess = true)
    {
        $counters = $this->get($this->flashParam, []);
        $counters[$key] = $removeAfterAccess ? -1 : 0;
        $_SESSION[$this->flashParam] = $counters;
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

removeFlash accesses the super-global variable $_SESSION.
Open

    public function removeFlash($key)
    {
        $counters = $this->get($this->flashParam, []);
        $value = isset($_SESSION[$key], $counters[$key]) ? $_SESSION[$key] : null;
        unset($counters[$key], $_SESSION[$key]);
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

set accesses the super-global variable $_SESSION.
Open

    public function set($key, $value)
    {
        $this->open();
        $_SESSION[$key] = $value;
    }
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

addFlash accesses the super-global variable $_SESSION.
Open

    public function addFlash($key, $value = true, $removeAfterAccess = true)
    {
        $counters = $this->get($this->flashParam, []);
        $counters[$key] = $removeAfterAccess ? -1 : 0;
        $_SESSION[$this->flashParam] = $counters;
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

removeAll accesses the super-global variable $_SESSION.
Open

    public function removeAll()
    {
        $this->open();
        foreach (array_keys($_SESSION) as $key) {
            unset($_SESSION[$key]);
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

offsetGet accesses the super-global variable $_SESSION.
Open

    public function offsetGet($offset)
    {
        $this->open();

        return isset($_SESSION[$offset]) ? $_SESSION[$offset] : null;
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

get accesses the super-global variable $_SESSION.
Open

    public function get($key, $defaultValue = null)
    {
        $this->open();
        return isset($_SESSION[$key]) ? $_SESSION[$key] : $defaultValue;
    }
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

updateFlashCounters accesses the super-global variable $_SESSION.
Open

    protected function updateFlashCounters()
    {
        $counters = $this->get($this->flashParam, []);
        if (is_array($counters)) {
            foreach ($counters as $key => $count) {
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

addFlash accesses the super-global variable $_SESSION.
Open

    public function addFlash($key, $value = true, $removeAfterAccess = true)
    {
        $counters = $this->get($this->flashParam, []);
        $counters[$key] = $removeAfterAccess ? -1 : 0;
        $_SESSION[$this->flashParam] = $counters;
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

removeFlash accesses the super-global variable $_SESSION.
Open

    public function removeFlash($key)
    {
        $counters = $this->get($this->flashParam, []);
        $value = isset($_SESSION[$key], $counters[$key]) ? $_SESSION[$key] : null;
        unset($counters[$key], $_SESSION[$key]);
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

removeAll accesses the super-global variable $_SESSION.
Open

    public function removeAll()
    {
        $this->open();
        foreach (array_keys($_SESSION) as $key) {
            unset($_SESSION[$key]);
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

updateFlashCounters accesses the super-global variable $_SESSION.
Open

    protected function updateFlashCounters()
    {
        $counters = $this->get($this->flashParam, []);
        if (is_array($counters)) {
            foreach ($counters as $key => $count) {
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

setFlash accesses the super-global variable $_SESSION.
Open

    public function setFlash($key, $value = true, $removeAfterAccess = true)
    {
        $counters = $this->get($this->flashParam, []);
        $counters[$key] = $removeAfterAccess ? -1 : 0;
        $_SESSION[$key] = $value;
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

removeFlash accesses the super-global variable $_SESSION.
Open

    public function removeFlash($key)
    {
        $counters = $this->get($this->flashParam, []);
        $value = isset($_SESSION[$key], $counters[$key]) ? $_SESSION[$key] : null;
        unset($counters[$key], $_SESSION[$key]);
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

addFlash accesses the super-global variable $_SESSION.
Open

    public function addFlash($key, $value = true, $removeAfterAccess = true)
    {
        $counters = $this->get($this->flashParam, []);
        $counters[$key] = $removeAfterAccess ? -1 : 0;
        $_SESSION[$this->flashParam] = $counters;
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

addFlash accesses the super-global variable $_SESSION.
Open

    public function addFlash($key, $value = true, $removeAfterAccess = true)
    {
        $counters = $this->get($this->flashParam, []);
        $counters[$key] = $removeAfterAccess ? -1 : 0;
        $_SESSION[$this->flashParam] = $counters;
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

removeFlash accesses the super-global variable $_SESSION.
Open

    public function removeFlash($key)
    {
        $counters = $this->get($this->flashParam, []);
        $value = isset($_SESSION[$key], $counters[$key]) ? $_SESSION[$key] : null;
        unset($counters[$key], $_SESSION[$key]);
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

removeAllFlashes accesses the super-global variable $_SESSION.
Open

    public function removeAllFlashes()
    {
        $counters = $this->get($this->flashParam, []);
        foreach (array_keys($counters) as $key) {
            unset($_SESSION[$key]);
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

has accesses the super-global variable $_SESSION.
Open

    public function has($key)
    {
        $this->open();
        return isset($_SESSION[$key]);
    }
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

addFlash accesses the super-global variable $_SESSION.
Open

    public function addFlash($key, $value = true, $removeAfterAccess = true)
    {
        $counters = $this->get($this->flashParam, []);
        $counters[$key] = $removeAfterAccess ? -1 : 0;
        $_SESSION[$this->flashParam] = $counters;
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

remove accesses the super-global variable $_SESSION.
Open

    public function remove($key)
    {
        $this->open();
        if (isset($_SESSION[$key])) {
            $value = $_SESSION[$key];
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

removeAllFlashes accesses the super-global variable $_SESSION.
Open

    public function removeAllFlashes()
    {
        $counters = $this->get($this->flashParam, []);
        foreach (array_keys($counters) as $key) {
            unset($_SESSION[$key]);
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

offsetExists accesses the super-global variable $_SESSION.
Open

    public function offsetExists($offset)
    {
        $this->open();

        return isset($_SESSION[$offset]);
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

offsetGet accesses the super-global variable $_SESSION.
Open

    public function offsetGet($offset)
    {
        $this->open();

        return isset($_SESSION[$offset]) ? $_SESSION[$offset] : null;
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

getAllFlashes accesses the super-global variable $_SESSION.
Open

    public function getAllFlashes($delete = false)
    {
        $counters = $this->get($this->flashParam, []);
        $flashes = [];
        foreach (array_keys($counters) as $key) {
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

offsetUnset accesses the super-global variable $_SESSION.
Open

    public function offsetUnset($offset)
    {
        $this->open();
        unset($_SESSION[$offset]);
    }
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

remove accesses the super-global variable $_SESSION.
Open

    public function remove($key)
    {
        $this->open();
        if (isset($_SESSION[$key])) {
            $value = $_SESSION[$key];
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

offsetSet accesses the super-global variable $_SESSION.
Open

    public function offsetSet($offset, $item)
    {
        $this->open();
        $_SESSION[$offset] = $item;
    }
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

getHasSessionId accesses the super-global variable $_COOKIE.
Open

    public function getHasSessionId()
    {
        if ($this->_hasSessionId === null) {
            $name = $this->getName();
            $request = Yii::$app->getRequest();
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

getAllFlashes accesses the super-global variable $_SESSION.
Open

    public function getAllFlashes($delete = false)
    {
        $counters = $this->get($this->flashParam, []);
        $flashes = [];
        foreach (array_keys($counters) as $key) {
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

freeze accesses the super-global variable $_SESSION.
Open

    protected function freeze()
    {
        if ($this->getIsActive()) {
            if (isset($_SESSION)) {
                $this->frozenSessionData = $_SESSION;
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

updateFlashCounters accesses the super-global variable $_SESSION.
Open

    protected function updateFlashCounters()
    {
        $counters = $this->get($this->flashParam, []);
        if (is_array($counters)) {
            foreach ($counters as $key => $count) {
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

addFlash accesses the super-global variable $_SESSION.
Open

    public function addFlash($key, $value = true, $removeAfterAccess = true)
    {
        $counters = $this->get($this->flashParam, []);
        $counters[$key] = $removeAfterAccess ? -1 : 0;
        $_SESSION[$this->flashParam] = $counters;
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

getCount accesses the super-global variable $_SESSION.
Open

    public function getCount()
    {
        $this->open();
        return count($_SESSION);
    }
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

getFlash accesses the super-global variable $_SESSION.
Open

    public function getFlash($key, $defaultValue = null, $delete = false)
    {
        $counters = $this->get($this->flashParam, []);
        if (isset($counters[$key])) {
            $value = $this->get($key, $defaultValue);
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 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: http://phpmd.org/rules/controversial.txt

The class Session has 27 non-getter- and setter-methods. Consider refactoring Session to keep number of methods under 25.
Open

class Session extends Component implements \IteratorAggregate, \ArrayAccess, \Countable
{
    /**
     * @var string the name of the session variable that stores the flash message data.
     */
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 0.1

A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects. By default it ignores methods starting with 'get' or 'set'. The default was changed from 10 to 25 in PHPMD 2.3.

Source: http://phpmd.org/rules/codesize.txt

The class Session has 23 public methods. Consider refactoring Session to keep number of public methods under 10.
Open

class Session extends Component implements \IteratorAggregate, \ArrayAccess, \Countable
{
    /**
     * @var string the name of the session variable that stores the flash message data.
     */
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects. By default it ignores methods starting with 'get' or 'set'.

Source: http://phpmd.org/rules/codesize.txt

The class Session has an overall complexity of 117 which is very high. The configured complexity threshold is 50.
Open

class Session extends Component implements \IteratorAggregate, \ArrayAccess, \Countable
{
    /**
     * @var string the name of the session variable that stores the flash message data.
     */
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 0.2.5

The Weighted Method Count (WMC) of a class is a good indicator of how much time and effort is required to modify and maintain this class. The WMC metric is defined as the sum of complexities of all methods declared in a class. A large number of methods also means that this class has a greater potential impact on derived classes.

Example:

class Foo {
      public function bar() {
          if ($a == $b)  {
              if ($a1 == $b1) {
                  fiddle();
              } elseif ($a2 == $b2) {
                  fiddle();
              } else {
              }
          }
      }
      public function baz() {
          if ($a == $b) {
              if ($a1 == $b1) {
                  fiddle();
              } elseif ($a2 == $b2) {
                  fiddle();
              } else {
              }
          }
      }
      // Several other complex methods
  }

Source: http://phpmd.org/rules/codesize.txt

The class Session has 54 public methods and attributes. Consider reducing the number of public items to less than 45.
Open

class Session extends Component implements \IteratorAggregate, \ArrayAccess, \Countable
{
    /**
     * @var string the name of the session variable that stores the flash message data.
     */
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 0.1

A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.

Example:

public class Foo {
      public $value;
      public $something;
      public $var;
      // [... more more public attributes ...]

      public function doWork() {}
      public function doMoreWork() {}
      public function doWorkAgain() {}
      // [... more more public methods ...]
  }

Source: http://phpmd.org/rules/codesize.txt

Function registerSessionHandler has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function registerSessionHandler()
    {
        if ($this->handler !== null) {
            if (!is_object($this->handler)) {
                $this->handler = Yii::createObject($this->handler);
Severity: Minor
Found in framework/web/Session.php - About 55 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 getAllFlashes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAllFlashes($delete = false)
    {
        $counters = $this->get($this->flashParam, []);
        $flashes = [];
        foreach (array_keys($counters) as $key) {
Severity: Minor
Found in framework/web/Session.php - About 45 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 updateFlashCounters has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    protected function updateFlashCounters()
    {
        $counters = $this->get($this->flashParam, []);
        if (is_array($counters)) {
            foreach ($counters as $key => $count) {
Severity: Minor
Found in framework/web/Session.php - About 45 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 setCookieParamsInternal has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private function setCookieParamsInternal()
    {
        $data = $this->getCookieParams();
        if (isset($data['lifetime'], $data['path'], $data['domain'], $data['secure'], $data['httponly'])) {
            if (PHP_VERSION_ID >= 70300) {
Severity: Minor
Found in framework/web/Session.php - About 45 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 getHasSessionId has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getHasSessionId()
    {
        if ($this->_hasSessionId === null) {
            $name = $this->getName();
            $request = Yii::$app->getRequest();
Severity: Minor
Found in framework/web/Session.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

The method setFlash has a boolean flag argument $value, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function setFlash($key, $value = true, $removeAfterAccess = true)
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example:

class Foo {
      public function bar($flag = true) {
      }
  }

Source: http://phpmd.org/rules/cleancode.txt

The method setFlash has a boolean flag argument $removeAfterAccess, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function setFlash($key, $value = true, $removeAfterAccess = true)
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example:

class Foo {
      public function bar($flag = true) {
      }
  }

Source: http://phpmd.org/rules/cleancode.txt

The method getFlash has a boolean flag argument $delete, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function getFlash($key, $defaultValue = null, $delete = false)
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example:

class Foo {
      public function bar($flag = true) {
      }
  }

Source: http://phpmd.org/rules/cleancode.txt

The method regenerateID has a boolean flag argument $deleteOldSession, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function regenerateID($deleteOldSession = false)
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example:

class Foo {
      public function bar($flag = true) {
      }
  }

Source: http://phpmd.org/rules/cleancode.txt

The method addFlash has a boolean flag argument $value, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function addFlash($key, $value = true, $removeAfterAccess = true)
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example:

class Foo {
      public function bar($flag = true) {
      }
  }

Source: http://phpmd.org/rules/cleancode.txt

The method getAllFlashes has a boolean flag argument $delete, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function getAllFlashes($delete = false)
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example:

class Foo {
      public function bar($flag = true) {
      }
  }

Source: http://phpmd.org/rules/cleancode.txt

The method addFlash has a boolean flag argument $removeAfterAccess, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function addFlash($key, $value = true, $removeAfterAccess = true)
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example:

class Foo {
      public function bar($flag = true) {
      }
  }

Source: http://phpmd.org/rules/cleancode.txt

Avoid unused parameters such as '$savePath'.
Open

    public function openSession($savePath, $sessionName)
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example:

class Foo
  {
      private function bar($howdy)
      {
          // $howdy is not used
      }
  }

Source: http://phpmd.org/rules/unusedcode.txt

Avoid unused parameters such as '$id'.
Open

    public function writeSession($id, $data)
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example:

class Foo
  {
      private function bar($howdy)
      {
          // $howdy is not used
      }
  }

Source: http://phpmd.org/rules/unusedcode.txt

Avoid unused parameters such as '$maxLifetime'.
Open

    public function gcSession($maxLifetime)
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example:

class Foo
  {
      private function bar($howdy)
      {
          // $howdy is not used
      }
  }

Source: http://phpmd.org/rules/unusedcode.txt

Avoid unused parameters such as '$sessionName'.
Open

    public function openSession($savePath, $sessionName)
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example:

class Foo
  {
      private function bar($howdy)
      {
          // $howdy is not used
      }
  }

Source: http://phpmd.org/rules/unusedcode.txt

Avoid unused parameters such as '$data'.
Open

    public function writeSession($id, $data)
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example:

class Foo
  {
      private function bar($howdy)
      {
          // $howdy is not used
      }
  }

Source: http://phpmd.org/rules/unusedcode.txt

Avoid unused parameters such as '$id'.
Open

    public function readSession($id)
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example:

class Foo
  {
      private function bar($howdy)
      {
          // $howdy is not used
      }
  }

Source: http://phpmd.org/rules/unusedcode.txt

Avoid unused parameters such as '$id'.
Open

    public function destroySession($id)
Severity: Minor
Found in framework/web/Session.php by phpmd

Since: PHPMD 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example:

class Foo
  {
      private function bar($howdy)
      {
          // $howdy is not used
      }
  }

Source: http://phpmd.org/rules/unusedcode.txt

There are no issues that match your filters.

Category
Status