Function getCodigoNome
has a Cognitive Complexity of 129 (exceeds 5 allowed). Consider refactoring. Open
public function getCodigoNome()
{
$codigo = $this->getCodigo();
if (\Cnab\Banco::BRADESCO == $this->_codigo_banco) {
- 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 getCodigoNome
has 254 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getCodigoNome()
{
$codigo = $this->getCodigo();
if (\Cnab\Banco::BRADESCO == $this->_codigo_banco) {
File Detalhe.php
has 493 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Cnab\Retorno\Cnab400;
class Detalhe extends \Cnab\Format\Linha implements \Cnab\Retorno\IDetalhe
Detalhe
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
class Detalhe extends \Cnab\Format\Linha implements \Cnab\Retorno\IDetalhe
{
public $_codigo_banco;
public function __construct(\Cnab\Retorno\IArquivo $arquivo)
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 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();
Function getAlegacaoPagador
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getAlegacaoPagador()
{
// @TODO: implementar funçao getAlegacaoPagador nos outros bancos
if ($this->_codigo_banco == 341) {
if ($this->getCodigo() == 25) {
- 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
Avoid too many return
statements within this method. Open
return 'Abatimento Concedido';
Avoid too many return
statements within this method. Open
return 'LIQUIDAÇÃO NORMAL';
Avoid too many return
statements within this method. Open
return 'CUSTAS DE EDITAL';
Avoid too many return
statements within this method. Open
return 'TARIFA DE OCORRÊNCIAS';
Avoid too many return
statements within this method. Open
return 'ENTRADA REJEITADA CARNÊ (NOTA 20 – TABELA 1)';
Avoid too many return
statements within this method. Open
return 'Acerto dos dados do rateio de Crédito';
Avoid too many return
statements within this method. Open
return 'Alteração da Opção de Protesto para Devolução';
Avoid too many return
statements within this method. Open
return 'Liquidação';
Avoid too many return
statements within this method. Open
return 'Baixa por Protesto';
Avoid too many return
statements within this method. Open
return 'ABATIMENTO CONCEDIDO ';
Avoid too many return
statements within this method. Open
return 'BAIXAS REJEITADAS (NOTA 20 - TABELA 4)';
Avoid too many return
statements within this method. Open
return 'CONFIRMA RECEBIMENTO DE INSTRUÇÃO DE NÃO PROTESTAR';
Avoid too many return
statements within this method. Open
return 'TARIFA MENSAL REF A ENTRADAS BANCOS CORRESPONDENTES NA CARTEIRA';
Avoid too many return
statements within this method. Open
return 'BAIXA POR CRÉDITO EM C/C ATRAVÉS DO SISPAG SEM TÍTULO CORRESPONDENTE';
Avoid too many return
statements within this method. Open
return 'CONFIRMAÇÃO DE ENTRADA NA COBRANÇA SIMPLES – ENTRADA NÃO ACEITA NA COBRANÇA CONTRATUAL';
Avoid too many return
statements within this method. Open
return 'Em Ser - Arquivo de Títulos pendentes';
Avoid too many return
statements within this method. Open
return 'Sustado judicial';
Avoid too many return
statements within this method. Open
return 'DÉBITO MENSAL DE TARIFAS – OUTRAS OCORRÊNCIAS';
Avoid too many return
statements within this method. Open
return 'TARIFA MENSAL DE LIQUIDAÇÕES EM BANCOS CORRESPONDENTES NA CARTEIRA';
Avoid too many return
statements within this method. Open
return 'Acerto de Depositária (sem motivo)';
Avoid too many return
statements within this method. Open
return 'Alteração com Reemissão de Bloqueto Confirmada';
Avoid too many return
statements within this method. Open
return 'Título enviado para Cartório';
Avoid too many return
statements within this method. Open
return 'Transferência de Carteira/Entrada';
Avoid too many return
statements within this method. Open
return 'Transferência de Carteira/Baixa';
Avoid too many return
statements within this method. Open
return 'Rejeição do Título – Cód. Rejeição informado nas POS 80 a 82';
Avoid too many return
statements within this method. Open
return 'LIQUIDAÇÃO EM CARTÓRIO ';
Avoid too many return
statements within this method. Open
return 'EM SER (SÓ NO RETORNO MENSAL)';
Avoid too many return
statements within this method. Open
return 'VENCIMENTO ALTERADO ';
Avoid too many return
statements within this method. Open
return 'TÍTULO ENVIADO A CARTÓRIO/TARIFA';
Avoid too many return
statements within this method. Open
return 'INSTRUÇÃO DE PROTESTO REJEITADA / SUSTADA / PENDENTE (NOTA 20 - TABELA 7)';
Avoid too many return
statements within this method. Open
return 'TARIFA DE EXTRATO POSIÇÃO (B40X)';
Avoid too many return
statements within this method. Open
return 'CUSTAS DE SUSTAÇÃO';
Avoid too many return
statements within this method. Open
return 'TARIFA MENSAL DE EMISSÃO DE BOLETO/TARIFA MENSAL DE ENVIO DE DUPLICATA';
Avoid too many return
statements within this method. Open
return 'Confirmação Receb. Inst. de Protesto';
Avoid too many return
statements within this method. Open
return 'Alteração de Outros Dados Rejeitados';
Avoid too many return
statements within this method. Open
return 'Instrução Rejeitada';
Avoid too many return
statements within this method. Open
return 'Confirmação Pedido Alteração Outros Dados';
Avoid too many return
statements within this method. Open
return 'Desagendamento do débito automático';
Avoid too many return
statements within this method. Open
return 'Cancelamento dos dados do rateio';
Avoid too many return
statements within this method. Open
return 'Entrada Confirmada';
Avoid too many return
statements within this method. Open
return 'ENTRADA CONFIRMADA COM POSSIBILIDADE DE MENSAGEM (NOTA 20 – TABELA 10) ';
Avoid too many return
statements within this method. Open
return 'TARIFA DE AVISO DE COBRANÇA';
Avoid too many return
statements within this method. Open
return 'TARIFA DE MANUTENÇÃO DE TÍTULOS VENCIDOS';
Avoid too many return
statements within this method. Open
return 'CUSTAS DE PROTESTO';
Avoid too many return
statements within this method. Open
return 'Liquidação em Cartório';
Avoid too many return
statements within this method. Open
return 'Liquidação após baixa ou Título não registrado';
Avoid too many return
statements within this method. Open
return 'Estorno de pagamento';
Avoid too many return
statements within this method. Open
return 'INSTRUÇÃO CANCELADA (NOTA 20 – TABELA 8)';
Avoid too many return
statements within this method. Open
return 'BAIXA POR CRÉDITO EM C/C ATRAVÉS DO SISPAG';
Avoid too many return
statements within this method. Open
return 'TARIFA EMISSÃO AVISO DE MOVIMENTAÇÃO DE TÍTULOS (2154)';
Avoid too many return
statements within this method. Open
return 'Acerto do Controle do Participante';
Avoid too many return
statements within this method. Open
return 'Débito de tarifas/custas';
Avoid too many return
statements within this method. Open
return 'ALTERAÇÃO DE DADOS – BAIXA';
Avoid too many return
statements within this method. Open
return 'Abatimento Cancelado';
Avoid too many return
statements within this method. Open
return 'Alteração Confirmada';
Avoid too many return
statements within this method. Open
return 'Liquidação em Cartório';
Avoid too many return
statements within this method. Open
return 'Outras Tarifas de Alteração';
Avoid too many return
statements within this method. Open
return 'DÉBITO MENSAL DE TARIFAS – OUTRAS INSTRUÇÕES';
Avoid too many return
statements within this method. Open
return 'Título Com Pagamento Cancelado';
Avoid too many return
statements within this method. Open
return 'DÉBITO MENSAL DE TARIFAS – MANUTENÇÃO DE TÍTULOS VENCIDOS';
Avoid too many return
statements within this method. Open
return 'Código Inexistente';
Avoid too many return
statements within this method. Open
return 'Tarifa sobre Título Vencido';
Avoid too many return
statements within this method. Open
return 'DÉBITO MENSAL DE TARIFAS – EXTRATO DE POSIÇÃO (B4EP/B4OX)';
Avoid too many return
statements within this method. Open
return 'CUSTAS DE SUSTAÇÃO JUDICIAL';
Avoid too many return
statements within this method. Open
return 'ENTRADA REGISTRADA, AGUARDANDO AVALIAÇÃO';
Avoid too many return
statements within this method. Open
return 'Entrada rejeitada por CEP Irregular';
Avoid too many return
statements within this method. Open
return 'Uso da Empresa Alterado';
Avoid too many return
statements within this method. Open
return 'Baixa por Franco Pagamento';
Avoid too many return
statements within this method. Open
return 'Sustação de Protesto';
Avoid too many return
statements within this method. Open
return 'BAIXA SIMPLES';
Avoid too many return
statements within this method. Open
return 'BAIXA POR TER SIDO LIQUIDADO ';
Avoid too many return
statements within this method. Open
return 'COBRANÇA CONTRATUAL - INSTRUÇÕES/ALTERAÇÕES REJEITADAS/PENDENTES (NOTA 20 - TABELA 5) ';
Avoid too many return
statements within this method. Open
return 'TARIFA DE RELAÇÃO DAS LIQUIDAÇÕES';
Avoid too many return
statements within this method. Open
return 'TARIFA MENSAL BAIXAS NA CARTEIRA';
Avoid too many return
statements within this method. Open
return 'Vencimento Alterado';
Avoid too many return
statements within this method. Open
return 'Estorno de Baixa/Liquidação';
Avoid too many return
statements within this method. Open
return 'Título Pago em Cheque – Vinculado';
Avoid too many return
statements within this method. Open
return 'Abatimento Cancelado';
Avoid too many return
statements within this method. Open
return 'Alteração da Opção de Devolução para protesto';
Avoid too many return
statements within this method. Open
return 'ALTERAÇÃO DE DADOS - NOVA ENTRADA OU ALTERAÇÃO/EXCLUSÃO DE DADOS ACATADA ';
Avoid too many return
statements within this method. Open
return 'CONFIRMA RECEBIMENTO DE INSTRUÇÃO DE PROTESTO';
Avoid too many return
statements within this method. Open
return 'CUSTAS DE CARTÓRIO DISTRIBUIDOR';
Avoid too many return
statements within this method. Open
return 'TARIFA MENSAL DE LIQUIDAÇÕES NA CARTEIRA';
Avoid too many return
statements within this method. Open
return 'Baixado conforme instruções da Agência';
Avoid too many return
statements within this method. Open
return 'Retirado de Cartório e Manutenção Carteira';
Avoid too many return
statements within this method. Open
return 'Baixa Confirmada';
Avoid too many return
statements within this method. Open
return 'Vencimento Alterado';
Avoid too many return
statements within this method. Open
return 'Em Ser';
Avoid too many return
statements within this method. Open
return 'Baixa por Devolução';
Avoid too many return
statements within this method. Open
return 'LIQUIDAÇÃO PARCIAL – COBRANÇA INTELIGENTE (B2B)';
Avoid too many return
statements within this method. Open
return 'CONFIRMA RECEBIMENTO DE INSTRUÇÃO DE SUSTAÇÃO DE PROTESTO /TARIFA';
Avoid too many return
statements within this method. Open
return 'ALEGAÇÕES DO SACADO (NOTA 20 - TABELA 6)';
Avoid too many return
statements within this method. Open
return 'BAIXA COM TRANSFERÊNCIA PARA DESCONTO';
Avoid too many return
statements within this method. Open
return 'Abatimento Concedido';
Avoid too many return
statements within this method. Open
return 'Entrada do Título em Cartório';
Avoid too many return
statements within this method. Open
return 'Baixa Rejeitada';
Avoid too many return
statements within this method. Open
return 'Prazo de Protesto Alterado';
Avoid too many return
statements within this method. Open
return 'Estorno de Sustação de Protesto';
Avoid too many return
statements within this method. Open
return 'Prazo de Devolução Alterado';
Avoid too many return
statements within this method. Open
return 'Alteração de Título';
Avoid too many return
statements within this method. Open
return 'DÉBITO MENSAL DE TARIFAS – SUSTAÇÃO DE PROTESTO';
Avoid too many return
statements within this method. Open
return 'ENTRADA REJEITADA (NOTA 20 - TABELA 1)';
Avoid too many return
statements within this method. Open
return 'DÉBITO MENSAL DE TARIFA - AVISO DE MOVIMENTAÇÃO DE TÍTULOS (2154)';
Avoid too many return
statements within this method. Open
return 'DÉBITO MENSAL DE TARIFAS (PARA ENTRADAS E BAIXAS)';
Avoid too many return
statements within this method. Open
return 'TARIFA DE INSTRUÇÃO';
Avoid too many return
statements within this method. Open
return 'DÉBITO MENSAL DE TARIFAS – PROTESTO';
Avoid too many return
statements within this method. Open
return 'CUSTAS DE IRREGULARIDADE';
Avoid too many return
statements within this method. Open
return 'ENTRADA CONFIRMADA COM RATEIO DE CRÉDITO';
Avoid too many return
statements within this method. Open
return 'CHEQUE DEVOLVIDO (NOTA 20 - TABELA 9)';
Avoid too many return
statements within this method. Open
return 'CHEQUE COMPENSADO';
Avoid too many return
statements within this method. Open
return 'Confirmação Recebimento Instrução Sustação de Protesto';
Avoid too many return
statements within this method. Open
return 'Estorno de Protesto';
Avoid too many return
statements within this method. Open
return 'ABATIMENTO CANCELADO';
Avoid too many return
statements within this method. Open
return 'INSTRUÇÕES REJEITADAS (NOTA 20 - TABELA 3) ';
Avoid too many return
statements within this method. Open
return 'ALTERAÇÃO/EXCLUSÃO DE DADOS REJEITADOS (NOTA 20 - TABELA 2)';
Avoid too many return
statements within this method. Open
return 'BAIXA POR TER SIDO PROTESTADO';
Avoid too many return
statements within this method. Open
return 'TARIFA DE EMISSÃO DE BOLETO/TARIFA DE ENVIO DE DUPLICATA';
Avoid too many return
statements within this method. Open
return 'TARIFA MENSAL BAIXAS EM BANCOS CORRESPONDENTES NA CARTEIRA';
Avoid too many return
statements within this method. Open
return 'TÍTULO SUSTADO JUDICIALMENTE';
Similar blocks of code found in 2 locations. Consider refactoring. Open
$tabela = array(
'AA' => 'CAIXA ELETRÔNICO BANCO ITAÚ',
'AC' => 'PAGAMENTO EM CARTÓRIO AUTOMATIZADO',
'AO' => 'ACERTO ONLINE',
'BC' => 'BANCOS CORRESPONDENTES',
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 122.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76