Showing 172 of 184 total issues
Function configure
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function configure(array $params)
{
$campos = array(
'data_geracao', 'data_gravacao', 'nome_fantasia', 'razao_social', 'cnpj', 'logradouro', 'numero', 'bairro',
'cidade', 'uf', 'cep', 'agencia', 'conta'
- Read upRead up
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 identifyFile
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function identifyFile($filename)
{
if (!file_exists($filename)) {
throw new \Exception('file dont exists: '.$filename);
}
Function decode
has a Cognitive Complexity of 16 (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']) {
- Read upRead up
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 validateCollision
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function validateCollision($fields)
{
foreach ($fields as $name => $field) {
$pos_start = $field['pos'][0];
$pos_end = $field['pos'][1];
- Read upRead up
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 __construct
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($codigo_banco, $filename, $layoutVersao = null)
{
$this->filename = $filename;
$this->layoutVersao = $layoutVersao;
File BancoDoBrasilTest.php
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Cnab\Tests\Remessa\Cnab240;
class BancoDoBrasilTest extends \PHPUnit_Framework_TestCase
Function formatarNossoNumero
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function formatarNossoNumero($nossoNumero)
{
if(!$nossoNumero)
return $nossoNumero;
- Read upRead up
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 47 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']) {
Method getAlegacaoPagador
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAlegacaoPagador()
{
// @TODO: implementar funçao getAlegacaoPagador nos outros bancos
if ($this->_codigo_banco == 341) {
if ($this->getCodigo() == 25) {
Method getText
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getText()
{
$numero_sequencial_lote = 1;
$qtde_registro_lote = 2; // header e trailer = 2
$qtde_titulo_cobranca_simples = 0;
Method testArquivoItauCnab400PodeSerLido
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testArquivoItauCnab400PodeSerLido()
{
$factory = new \Cnab\Factory();
$arquivo = $factory->createRetorno('tests/fixtures/cnab400/retorno-cnab400-itau.ret');
$this->assertNotNull($arquivo);
Function getEncoded
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function getEncoded()
{
if ($this->validate()) {
$max_pos_end = 0;
$dados = '';
- Read upRead up
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 testArquivoCaixaSigcbPodeSerLido
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testArquivoCaixaSigcbPodeSerLido()
{
$factory = new \Cnab\Factory();
$arquivo = $factory->createRetorno('tests/fixtures/cnab240/retorno_cnab240_caixa.ret');
$this->assertNotNull($arquivo);
Method __construct
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($codigo_banco, $filename, $layoutVersao = null)
{
$this->filename = $filename;
$this->layoutVersao = $layoutVersao;
Method getCodigoNome
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getCodigoNome()
{
$codigo = (int) $this->getCodigo();
$table = array(
Method getDescricaoLiquidacao
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getDescricaoLiquidacao()
{
// @TODO: Usar YAML (cnab_yaml) para criar tabela de descrição
$codigoLiquidacao = $this->getCodigoLiquidacao();
$tabela = array();
Consider simplifying this complex logical expression. Open
if (($pos_start >= $current_pos_start && $pos_start <= $current_pos_end) ||
($pos_end <= $current_pos_end && $pos_end >= $current_pos_start) ||
($current_pos_start >= $pos_start && $current_pos_start <= $pos_end) ||
($current_pos_end <= $pos_end && $current_pos_end >= $pos_start)) {
unset($this->fields[$key]);
Method formatarNossoNumero
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function formatarNossoNumero($nossoNumero)
{
if(!$nossoNumero)
return $nossoNumero;
Function __construct
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($codigo_banco, $filename, $layoutVersao = null)
{
$this->filename = $filename;
$this->layoutVersao = $layoutVersao;
- Read upRead up
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 addField
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function addField($nome, $pos_start, $pos_end, $format, $default, $options)
{
foreach ($this->fields as $key => $field) {
$current_pos_start = $field->pos_start;
$current_pos_end = $field->pos_end;
- Read upRead up
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"