Dhii/di-abstract

View on GitHub
src/AbstractContainer.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid assigning values to variables in if clauses and the like (line '71', column '15').
Open

    protected function _make($id, $config = array())
    {
        if (!($definition = $this->_getDefinition($id))) {
            throw $this->_createNotFoundException(sprintf('Could not create service for ID "%1$s": no service defined', $id));
        }
Severity: Minor
Found in src/AbstractContainer.php by phpmd

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

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

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

    protected function _get($id)
Severity: Minor
Found in src/AbstractContainer.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

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

    protected function _make($id, $config = array())
Severity: Minor
Found in src/AbstractContainer.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

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

    protected function _cacheService($id, $service)
Severity: Minor
Found in src/AbstractContainer.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

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

    protected function _setDefinition($id, $definition)
Severity: Minor
Found in src/AbstractContainer.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

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

    protected function _isCached($id)
Severity: Minor
Found in src/AbstractContainer.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

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

    protected function _has($id)
Severity: Minor
Found in src/AbstractContainer.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

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

    protected function _getCached($id)
Severity: Minor
Found in src/AbstractContainer.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

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

    protected function _set($id, $definition = null)
Severity: Minor
Found in src/AbstractContainer.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

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

    protected function _hasDefinition($id)
Severity: Minor
Found in src/AbstractContainer.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

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

    protected function _getDefinition($id)
Severity: Minor
Found in src/AbstractContainer.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 variable $_id is not named in camelCase.
Open

    protected function _register(BaseServiceProvider $provider)
    {
        foreach ($provider->getServices() as $_id => $_definition) {
            $this->_setDefinition($_id, $_definition);
        }
Severity: Minor
Found in src/AbstractContainer.php by phpmd

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

The variable $_id is not named in camelCase.
Open

    protected function _register(BaseServiceProvider $provider)
    {
        foreach ($provider->getServices() as $_id => $_definition) {
            $this->_setDefinition($_id, $_definition);
        }
Severity: Minor
Found in src/AbstractContainer.php by phpmd

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

The variable $_definition is not named in camelCase.
Open

    protected function _register(BaseServiceProvider $provider)
    {
        foreach ($provider->getServices() as $_id => $_definition) {
            $this->_setDefinition($_id, $_definition);
        }
Severity: Minor
Found in src/AbstractContainer.php by phpmd

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

The variable $_definition is not named in camelCase.
Open

    protected function _register(BaseServiceProvider $provider)
    {
        foreach ($provider->getServices() as $_id => $_definition) {
            $this->_setDefinition($_id, $_definition);
        }
Severity: Minor
Found in src/AbstractContainer.php by phpmd

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

The method _setDefinition is not named in camelCase.
Open

    protected function _setDefinition($id, $definition)
    {
        $this->serviceDefinitions[$id] = $definition;

        return $this;
Severity: Minor
Found in src/AbstractContainer.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method _resolveDefinition is not named in camelCase.
Open

    protected function _resolveDefinition($definition, $config)
    {
        if (!is_callable($definition)) {
            throw $this->_createContainerException(sprintf('Could not resolve service definition": definition must be callable'));
        }
Severity: Minor
Found in src/AbstractContainer.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method _has is not named in camelCase.
Open

    protected function _has($id)
    {
        return $this->_hasDefinition($id);
    }
Severity: Minor
Found in src/AbstractContainer.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method _hasDefinition is not named in camelCase.
Open

    protected function _hasDefinition($id)
    {
        return isset($this->serviceDefinitions[$id]);
    }
Severity: Minor
Found in src/AbstractContainer.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method _isCached is not named in camelCase.
Open

    protected function _isCached($id)
    {
        return isset($this->serviceCache[$id]);
    }
Severity: Minor
Found in src/AbstractContainer.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method _register is not named in camelCase.
Open

    protected function _register(BaseServiceProvider $provider)
    {
        foreach ($provider->getServices() as $_id => $_definition) {
            $this->_setDefinition($_id, $_definition);
        }
Severity: Minor
Found in src/AbstractContainer.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method _getCached is not named in camelCase.
Open

    protected function _getCached($id)
    {
        return isset($this->serviceCache[$id])
            ? $this->serviceCache[$id]
            : null;
Severity: Minor
Found in src/AbstractContainer.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method _make is not named in camelCase.
Open

    protected function _make($id, $config = array())
    {
        if (!($definition = $this->_getDefinition($id))) {
            throw $this->_createNotFoundException(sprintf('Could not create service for ID "%1$s": no service defined', $id));
        }
Severity: Minor
Found in src/AbstractContainer.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method _get is not named in camelCase.
Open

    protected function _get($id)
    {
        if ($this->_isCached($id)) {
            return $this->_getCached($id);
        }
Severity: Minor
Found in src/AbstractContainer.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method _getDefinition is not named in camelCase.
Open

    protected function _getDefinition($id)
    {
        return isset($this->serviceDefinitions[$id])
            ? $this->serviceDefinitions[$id]
            : null;
Severity: Minor
Found in src/AbstractContainer.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method _getDefinitions is not named in camelCase.
Open

    protected function _getDefinitions()
    {
        return $this->serviceDefinitions;
    }
Severity: Minor
Found in src/AbstractContainer.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method _set is not named in camelCase.
Open

    protected function _set($id, $definition = null)
    {
        if ($id instanceof BaseServiceProvider) {
            $this->_register($id);

Severity: Minor
Found in src/AbstractContainer.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method _cacheService is not named in camelCase.
Open

    protected function _cacheService($id, $service)
    {
        $this->serviceCache[$id] = $service;

        return $this;
Severity: Minor
Found in src/AbstractContainer.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method _createNotFoundException is not named in camelCase.
Open

    abstract protected function _createNotFoundException($message, $code = 0, Exception $innerException = null);
Severity: Minor
Found in src/AbstractContainer.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method _createContainerException is not named in camelCase.
Open

    abstract protected function _createContainerException($message, $code = 0, Exception $innerException = null);
Severity: Minor
Found in src/AbstractContainer.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

There are no issues that match your filters.

Category
Status