PHPSocialNetwork/phpfastcache-bundle

View on GitHub
src/DataCollector/CacheCollector.php

Summary

Maintainability
A
1 hr
Test Coverage

Method collect has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function collect(Request $request, Response $response, \Exception $exception = null)
    {
        $size = 0;
        $stats = [];
        $instances = [];
Severity: Minor
Found in src/DataCollector/CacheCollector.php - About 1 hr to fix

    Avoid using static access to class '\Phpfastcache\Api' in method 'collect'.
    Open

              'apiChangelog' => PhpfastcacheApi::getChangelog(),
    Severity: Minor
    Found in src/DataCollector/CacheCollector.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\Phpfastcache\CacheManager' in method 'collect'.
    Open

                'namespacePath (deprecated)' => CacheManager::getNamespacePath(),
    Severity: Minor
    Found in src/DataCollector/CacheCollector.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\Phpfastcache\Api' in method 'collect'.
    Open

              'apiVersion' => PhpfastcacheApi::getVersion(),
    Severity: Minor
    Found in src/DataCollector/CacheCollector.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\Phpfastcache\Api' in method 'collect'.
    Open

              'pfcVersion' => PhpfastcacheApi::getPhpFastCacheVersion(),
    Severity: Minor
    Found in src/DataCollector/CacheCollector.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\Phpfastcache\CacheManager' in method 'collect'.
    Open

                'driverList' => CacheManager::getDriverList(true),
    Severity: Minor
    Found in src/DataCollector/CacheCollector.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid unused parameters such as '$response'.
    Open

        public function collect(Request $request, Response $response, \Exception $exception = null)
    Severity: Minor
    Found in src/DataCollector/CacheCollector.php by phpmd

    UnusedFormalParameter

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

    Avoid unused parameters such as '$exception'.
    Open

        public function collect(Request $request, Response $response, \Exception $exception = null)
    Severity: Minor
    Found in src/DataCollector/CacheCollector.php by phpmd

    UnusedFormalParameter

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

    Avoid unused parameters such as '$request'.
    Open

        public function collect(Request $request, Response $response, \Exception $exception = null)
    Severity: Minor
    Found in src/DataCollector/CacheCollector.php by phpmd

    UnusedFormalParameter

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

    The property $twig_cache_blocks is not named in camelCase.
    Open

    class CacheCollector extends DataCollector
    {
        /**
         * @var \Phpfastcache\Bundle\Service\Phpfastcache
         */
    Severity: Minor
    Found in src/DataCollector/CacheCollector.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    There are no issues that match your filters.

    Category
    Status