CORE-POS/Common-Bundle

View on GitHub
src/NamedSession.php

Summary

Maintainability
A
0 mins
Test Coverage

__get accesses the super-global variable $_SESSION.
Open

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

__isset accesses the super-global variable $_SESSION.
Open

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

__unset accesses the super-global variable $_SESSION.
Open

    public function __unset($key)
    {
        $realKey = $this->name . '-' . $key;
        unset($_SESSION[$realKey]);
    }
Severity: Minor
Found in src/NamedSession.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)
    {
        $realKey = $this->name . '-' . $key;
        return isset($_SESSION[$realKey]) ? $_SESSION[$realKey] : '';
    }
Severity: Minor
Found in src/NamedSession.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

__set accesses the super-global variable $_SESSION.
Open

    public function __set($key, $val)
    {
        $realKey = $this->name . '-' . $key;
        $_SESSION[$realKey] = $val;

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

Remove error control operator '@' on line 20.
Open

    public function __construct($name)
    {
        // security is not the goal here.
        // hashing just serves to normalize length.
        $this->name = sha1($name);
Severity: Minor
Found in src/NamedSession.php by phpmd

ErrorControlOperator

Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

Example

function foo($filePath) {
    $file = @fopen($filPath); // hides exceptions
    $key = @$array[$notExistingKey]; // assigns null to $key
}

Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

There are no issues that match your filters.

Category
Status