Showing 22 of 22 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
<?php
namespace Dephpug\Exporter\Type;
use Dephpug\Exporter\iExporter;
- 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 129.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
<?php
namespace Dephpug\Exporter\Type;
use Dephpug\Exporter\iExporter;
- 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 129.
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
A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 18 and the first side effect is on line 5. Open
<?php
- Exclude checks
A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 15 and the first side effect is on line 5. Open
<?php
- Exclude checks
Function execute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function execute(InputInterface $_, OutputInterface $output)
{
$output->write(splashScreen());
while (true) {
try {
- 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 xmlBeautifier
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function xmlBeautifier($xml)
{
$xml = preg_replace('/(>)(<)(\/*)/', "$1\n$2$3", $xml);
$token = strtok($xml, "\n");
$result = '';
- 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
Line exceeds 120 characters; contains 130 characters Open
'This command make the debugger run again until find a next breakpoint or finish the script (request or cli script).',
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
<fg=blue>Obs: You don't need use echo or var_dump/print_r. Use only the variable or function to get the value exported.</>
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
'The dephpugger convert commands to dbgp protocol format to make a developer\'s life easier (like `n` to `step_over -i 1`).',
- Exclude checks
Line exceeds 120 characters; contains 130 characters Open
'This command make the debugger run again until find a next breakpoint or finish the script (request or cli script).',
- Exclude checks
Line exceeds 120 characters; contains 230 characters Open
* <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="property_get" transaction_id="5"><property name="$d" fullname="$d" type="float"><![CDATA[3.3333333333333]]></property></response>
- Exclude checks
Line exceeds 120 characters; contains 174 characters Open
$command = "{$configVar} {$phpPath} -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug.remote_port={$debuggerPort} -dxdebug.remote_host=127.0.0.1 {$phpFile}";
- Exclude checks
Line exceeds 120 characters; contains 152 characters Open
* <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="0" status="break" reason="ok">
- Exclude checks
Line exceeds 120 characters; contains 421 characters Open
* <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///path/of/index.php" language="PHP" xdebug:language_version="7.0.4-5ubuntu1" protocol_version="" appid=""><engine version=""><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2016 by Derick Rethans]]></copyright></init>
- Exclude checks
Line exceeds 120 characters; contains 160 characters Open
* <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="property_get" transaction_id="1" status="break" reason="ok">
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
$phar->setStub("#!/usr/bin/env php\n<?php Phar::mapPhar('dephpugger.phar'); require 'phar://dephpugger.phar/bin/dephpugger'; __HALT_COMPILER();");
- Exclude checks
Line exceeds 120 characters; contains 165 characters Open
* <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="1" status="stopping" reason="ok"></response>
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
return 'This command ask if you want to close the debugger. The request/script will continue when the debugger stop.';
- Exclude checks
Interface name "iCommand" is not in camel caps format Open
interface iCommand
- Exclude checks
Interface name "iExporter" is not in camel caps format Open
interface iExporter
- Exclude checks