bluetree-service/cache

View on GitHub
src/Storage/File.php

Summary

Maintainability
A
0 mins
Test Coverage

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

    protected function delete($key, $isKey = true)
Severity: Minor
Found in src/Storage/File.php by phpmd

BooleanArgumentFlag

Since: 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 https://phpmd.org/rules/cleancode.html#booleanargumentflag

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

    public function clearMany(array $list, $isKey = true)
Severity: Minor
Found in src/Storage/File.php by phpmd

BooleanArgumentFlag

Since: 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 https://phpmd.org/rules/cleancode.html#booleanargumentflag

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

    public function store(CacheItemInterface $item)
    {
        $data = serialize($item);
        $key = $item->getKey();

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

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

    protected function delete($key, $isKey = true)
    {
        if ($isKey) {
            unset($this->currentCache[$key]);
            $key = $this->getFilePath($key);
Severity: Minor
Found in src/Storage/File.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