rogervila/cart

View on GitHub
src/Session.php

Summary

Maintainability
A
0 mins
Test Coverage

has accesses the super-global variable $_SESSION.
Open

    public function has($key)
    {
        return isset($_SESSION[$this->name][$key]);
    }
Severity: Minor
Found in src/Session.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

put accesses the super-global variable $_SESSION.
Open

    public function put($key, $value)
    {
        $_SESSION[$this->name][$key] = serialize($value);

        return $_SESSION[$this->name][$key];
Severity: Minor
Found in src/Session.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

get accesses the super-global variable $_SESSION.
Open

    public function get($key)
    {
        if ($this->has($key)) {
            return unserialize($_SESSION[$this->name][$key]);
        }
Severity: Minor
Found in src/Session.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

put accesses the super-global variable $_SESSION.
Open

    public function put($key, $value)
    {
        $_SESSION[$this->name][$key] = serialize($value);

        return $_SESSION[$this->name][$key];
Severity: Minor
Found in src/Session.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

forget accesses the super-global variable $_SESSION.
Open

    public function forget($key)
    {
        if ($this->has($key)) {
            unset($_SESSION[$this->name][$key]);

Severity: Minor
Found in src/Session.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

flush accesses the super-global variable $_SESSION.
Open

    public function flush()
    {
        $_SESSION[$this->name] = [];

        return true;
Severity: Minor
Found in src/Session.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

There are no issues that match your filters.

Category
Status