glauberportella/cnab-layouts-parser

View on GitHub

Showing 17 of 93 total issues

Function encode has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

    public static function encode($value, $format, $options)
    {
        $m = array();
        if (\preg_match(self::REGEX_VALID_FORMAT, $format, $m)) {
            if ($m['tipo1'] == 'X' && !$m['tipo2']) {
Severity: Minor
Found in src/CnabParser/Format/Picture.php - About 1 day 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

Method testRemessaPagamentosOk has 147 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testRemessaPagamentosOk()
    {
        $remessaLayout = new Layout(__DIR__.'/../../../config/febraban/cnab240/pagamentos.yml');
        $remessa = new Remessa($remessaLayout);
        $this->assertInstanceOf('CnabParser\Model\Remessa', $remessa);
Severity: Major
Found in tests/unit/remessa/ParserFebrabanPagamentoTest.php - About 5 hrs to fix

    Method testJsonSerializeRemessaOk has 103 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function testJsonSerializeRemessaOk()
        {
            $remessaLayout = new Layout(__DIR__.'/../../../config/itau/cnab240/cobranca.yml');
            $remessa = new Remessa($remessaLayout);
            $this->assertInstanceOf('CnabParser\Model\Remessa', $remessa);
    Severity: Major
    Found in tests/unit/remessa/JsonSerializeTest.php - About 4 hrs to fix

      Method testRemessaOk has 98 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function testRemessaOk()
          {
              $remessaLayout = new Layout(__DIR__.'/../../../config/itau/cnab240/cobranca.yml');
              $remessa = new Remessa($remessaLayout);
              $this->assertInstanceOf('CnabParser\Model\Remessa', $remessa);
      Severity: Major
      Found in tests/unit/remessa/ParserItauCobrancaCnab240Test.php - About 3 hrs to fix

        Method testRemessaOk has 86 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function testRemessaOk()
            {
                $remessaLayout = new Layout(__DIR__.'/../../../config/cef/cnab400/cobranca_sigcb.yml');
                $remessa = new Remessa($remessaLayout);
                $this->assertInstanceOf('CnabParser\Model\Remessa', $remessa);
        Severity: Major
        Found in tests/unit/remessa/ParserCEFCobrancaCnab400Test.php - About 3 hrs to fix

          Function decode has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function decode($value, $format, $options)
              {
                  $m = array();
                  if (preg_match(self::REGEX_VALID_FORMAT, $format, $m)) {
                      if ($m['tipo1'] == 'X' && !$m['tipo2']) {
          Severity: Minor
          Found in src/CnabParser/Format/Picture.php - About 3 hrs 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

          Method encode has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function encode($value, $format, $options)
              {
                  $m = array();
                  if (\preg_match(self::REGEX_VALID_FORMAT, $format, $m)) {
                      if ($m['tipo1'] == 'X' && !$m['tipo2']) {
          Severity: Major
          Found in src/CnabParser/Format/Picture.php - About 2 hrs to fix

            Method decodeLotesCnab240 has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function decodeLotesCnab240()
                {
                    $defTipoRegistro = array(
                        'pos' => array(8, 8),
                        'picture' => '9(1)',
            Severity: Major
            Found in src/CnabParser/Input/RetornoFile.php - About 2 hrs to fix

              Method testRetornoGenerateModelSuccess has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function testRetornoGenerateModelSuccess()
                  {
                      $layout = new Layout(__DIR__.'/../../../config/itau/cnab400/cobranca.yml');
                      $retornoFile = new RetornoFile($layout, __DIR__.'/../../data/cobranca-itau-cnab400.ret');
              
              
              Severity: Minor
              Found in tests/unit/retorno/RetornoParserItauCobrancaCnab400Test.php - About 1 hr to fix

                Method testRetornoGenerateModelSuccess has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function testRetornoGenerateModelSuccess()
                    {
                        $layout = new Layout(__DIR__.'/../../../config/itau/cnab240/cobranca.yml');
                        $retornoFile = new RetornoFile($layout, __DIR__.'/../../data/cobranca-itau-cnab240.ret');
                
                
                Severity: Minor
                Found in tests/unit/retorno/RetornoParserItauCobrancaCnab240Test.php - About 1 hr to fix

                  Method decodeLotesCnab400 has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function decodeLotesCnab400()
                      {
                          $defTipoRegistro = array(
                              'pos' => array(1, 1),
                              'picture' => '9(1)',
                  Severity: Minor
                  Found in src/CnabParser/Input/RetornoFile.php - About 1 hr to fix

                    Method decode has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function decode($value, $format, $options)
                        {
                            $m = array();
                            if (preg_match(self::REGEX_VALID_FORMAT, $format, $m)) {
                                if ($m['tipo1'] == 'X' && !$m['tipo2']) {
                    Severity: Minor
                    Found in src/CnabParser/Format/Picture.php - About 1 hr to fix

                      Function decodeLotesCnab240 has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function decodeLotesCnab240()
                          {
                              $defTipoRegistro = array(
                                  'pos' => array(8, 8),
                                  'picture' => '9(1)',
                      Severity: Minor
                      Found in src/CnabParser/Input/RetornoFile.php - About 1 hr 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 novoDetalhe has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function novoDetalhe(array $excetoSegmentos = array())
                          {
                              $detalhe = new \stdClass;
                              if (isset($this->layout['detalhes'])) {
                                  foreach ($this->layout['detalhes'] as $segmento => $segmentoDefinitions) {
                      Severity: Minor
                      Found in src/CnabParser/Model/Lote.php - About 1 hr 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 decodeLotesCnab400 has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function decodeLotesCnab400()
                          {
                              $defTipoRegistro = array(
                                  'pos' => array(1, 1),
                                  'picture' => '9(1)',
                      Severity: Minor
                      Found in src/CnabParser/Input/RetornoFile.php - About 1 hr 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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function __construct(Layout $layout)
                          {
                              parent::__construct($layout);
                      
                              $remessaLayout = $this->layout->getRemessaLayout();
                      Severity: Minor
                      Found in src/CnabParser/Model/Remessa.php - About 25 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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function __construct(array $layout, $sequencial = 1)
                          {
                              $this->layout = $layout;
                      
                              $this->sequencial = $sequencial;
                      Severity: Minor
                      Found in src/CnabParser/Model/Lote.php - About 25 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

                      Severity
                      Category
                      Status
                      Source
                      Language