NovikovViktor/RequestLimitBundle

View on GitHub

Showing 102 of 102 total issues

Avoid excessively long variable names like $providerConfiguration. Keep variable name length under 20.
Open

        $providerConfiguration = $config['provider_configuration'];

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $storageManagerDefinition. Keep variable name length under 20.
Open

        $storageManagerDefinition = $container->getDefinition('nw.request_limit.storage_manager');

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $providerConfiguration. Keep variable name length under 20.
Open

        $providerConfiguration   = $container->getParameter('nw_request_limit.provider_configuration');

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $providerTypeServiceName. Keep variable name length under 20.
Open

        $providerTypeServiceName = sprintf('nw.request_limit.%s.provider', $providerType);

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class AppKernel extends Kernel
Severity: Minor
Found in Tests/AppKernel.php by phpcodesniffer

The property $_memcached is not named in camelCase.
Open

class MemcachedProvider implements ProviderInterface
{
    /**
     * @var Memcached $_memcached
     */

CamelCasePropertyName

Since: 0.2

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

Example

class ClassName {
    protected $property_name;
}

Source

Avoid variables with short names like $em. Configured minimum length is 3.
Open

    public function __construct(EntityManager $em)
Severity: Minor
Found in Storage/Provider/MySQLProvider.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

The property $_em is not named in camelCase.
Open

class MySQLProvider implements ProviderInterface
{
    /**
     * @var EntityManager $_em
     */
Severity: Minor
Found in Storage/Provider/MySQLProvider.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

Property name "$_em" should not be prefixed with an underscore to indicate visibility
Open

    private $_em;

Property name "$_memcached" should not be prefixed with an underscore to indicate visibility
Open

    private $_memcached;

Missing class import via use statement (line '18', column '30').
Open

            $bundles[] = new Symfony\Bundle\FrameworkBundle\FrameworkBundle();
Severity: Minor
Found in Tests/AppKernel.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

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

Missing class import via use statement (line '64', column '32').
Open

        $value = $value ?: new \DateTime("+{$this->restrictionTime} seconds");
Severity: Minor
Found in Storage/StorageManager.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

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

Missing class import via use statement (line '99', column '33').
Open

        $currentDate      = new \DateTime();
Severity: Minor
Found in Storage/StorageManager.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

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

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

    private function getStorageManagerMock($item = 'userId', $hasItem = false)
Severity: Minor
Found in Tests/Unit/Utils/RestrictorTest.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

Missing class import via use statement (line '19', column '30').
Open

            $bundles[] = new NW\RequestLimitBundle\NWRequestLimitBundle();
Severity: Minor
Found in Tests/AppKernel.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

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

Avoid unused parameters such as '$output'.
Open

    protected function execute(InputInterface $input, OutputInterface $output)
Severity: Minor
Found in Command/MySQLProviderSetupCommand.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 '$configuration'.
Open

    public function configure($configuration)
Severity: Minor
Found in Storage/Provider/MySQLProvider.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 '$input'.
Open

    protected function execute(InputInterface $input, OutputInterface $output)
Severity: Minor
Found in Command/MySQLProviderSetupCommand.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 using static access to class '\DateTime' in method 'get'.
Open

        $date = \DateTime::createFromFormat('Y-m-d H:i:s', $result[0]);
Severity: Minor
Found in Storage/Provider/MySQLProvider.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

The variable $_memcached is not named in camelCase.
Open

    public function configure($configuration)
    {
        $memcachedHost = $configuration['server'];
        $memcachedPort = $configuration['port'];
        $_memcached = new Memcached();

CamelCaseVariableName

Since: 0.2

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

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

Severity
Category
Status
Source
Language