Infanatica/InfanaticaCepModule

View on GitHub

Showing 186 of 186 total issues

Avoid using undefined variables such as '$retorno' which will lead to PHP notices.
Open

        $retorno['bairro']      = $this->getBairro();

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

Avoid using undefined variables such as '$retorno' which will lead to PHP notices.
Open

        return $retorno;

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

Avoid using undefined variables such as '$retorno' which will lead to PHP notices.
Open

        $retorno['uf']          = $this->getUf();

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

Avoid using undefined variables such as '$retorno' which will lead to PHP notices.
Open

        $retorno['localidade']  = $this->getLocalidade();

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

Avoid using undefined variables such as '$retorno' which will lead to PHP notices.
Open

        $retorno['logradouro']  = $this->getLogradouro();

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

Method parseResponse has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function parseResponse($response)
    {
        if(!$this->isJson($response))
        {
            throw new CepNotFoundException();
Severity: Minor
Found in src/InfanaticaCepModule/Adapter/ViaCepAdapter.php - About 1 hr to fix

    Method parseResponse has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function parseResponse($response)
        {
            if(!$this->isJson($response))
            {
                throw new CepNotFoundException();
    Severity: Minor
    Found in src/InfanaticaCepModule/Adapter/PostmonAdapter.php - About 1 hr to fix

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

          public function setUf($uf);

      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 $uf. Configured minimum length is 3.
      Open

          protected $uf;

      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 $e. Configured minimum length is 3.
      Open

          public function onBootstrap(MvcEvent $e)
      Severity: Minor
      Found in Module.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 $uf. Configured minimum length is 3.
      Open

          public function setUf($uf)

      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

      Function parseResponse has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function parseResponse($response)
          {
              if(!$this->isJson($response))
              {
                  throw new CepNotFoundException();
      Severity: Minor
      Found in src/InfanaticaCepModule/Adapter/PostmonAdapter.php - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function parseResponse has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function parseResponse($response)
          {
              if(!$this->isJson($response))
              {
                  throw new CepNotFoundException();
      Severity: Minor
      Found in src/InfanaticaCepModule/Adapter/ViaCepAdapter.php - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function parseResponse has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function parseResponse($response)
          {
              if(!$this->isJson($response))
              {
                  throw new CepNotFoundException();
      Severity: Minor
      Found in src/InfanaticaCepModule/Adapter/RepublicaVirtualAdapter.php - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Expected "function abc(...)"; found "function abc (...)"
      Open

          protected function isJson ($string)

      Opening brace of a class must be on the line after the definition
      Open

      class CorreioControlAdapter implements CepAdapterInterface {

      Expected 1 space between comma and type hint "EnderecoResponse"; 0 found
      Open

          public function __construct(Client $httpClient,EnderecoResponse $enderecoResponse)

      Expected "function abc(...)"; found "function abc (...)"
      Open

          protected function isJson ($string)

      Opening brace of a class must be on the line after the definition
      Open

      class CepServiceFactory implements FactoryInterface{

      Opening brace of a class must be on the line after the definition
      Open

      class ViaCepAdapter implements CepAdapterInterface {
      Severity
      Category
      Status
      Source
      Language