Showing 159 of 159 total issues
Cookie
has 37 functions (exceeds 20 allowed). Consider refactoring. Open
class Cookie
{
/**
* Transform array values as flatten string (`serialize` like)
Function _treatOptions
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
protected function _treatOptions()
{
$this->params = self::getopt();
$this->debugWrite( ">> Command line arguments are [".var_export($this->params,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
Function purge
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public static function purge($path = null, array &$logs = array())
{
if (is_null($path)) {
return null;
}
- 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 parse
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public static function parse($node)
{
$output = array();
switch ($node->nodeType) {
case XML_CDATA_SECTION_NODE:
- 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 remove
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public static function remove($path = null, array &$logs = array())
{
if (is_null($path)) {
return null;
}
- 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 __construct
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(array $options = array())
{
// if (!isset($this->options)) $this->options = array();
$this
->_initOptions()
- 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 getHelpInfo
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getHelpInfo(array $options = array(), Formater $formater, $caller)
{
if (!is_object($caller) || !($caller instanceof CommandLineControllerInterface)) {
throw new InvalidArgumentException(
sprintf('Argument 3 for method "%s::getHelpInfo" must be an object and implement the "CommandLineControllerInterface" interface!', __CLASS__)
Response
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class Response
implements ResponseInterface
{
/**
File Factory.php
has 297 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* This file is part of the Library package.
*
* Copyleft (ↄ) 2013-2016 Pierre Cassat <me@e-piwi.fr> and contributors
Similar blocks of code found in 2 locations. Consider refactoring. Open
echo 'interface MyInterface {'."\n"
."\t".'public function mustImplement();'."\n"
.'}'."\n"
.'class MyClass implements MyInterface {'."\n"
."\t".'public function mustImplement()'."\n"
- 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 141.
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
echo 'class DefaultConfig implements \Library\StaticConfiguration\ConfiguratorInterface {'."\n"
."\t".'public static function getDefaults() {'."\n"
."\t\t".'return array('."\n"
."\t\t\t".'"entry1" => array( "library-assets" ),'."\n"
."\t\t\t".'"entry2" => "test",'."\n"
- 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 141.
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
Function _parseTableSizes
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
protected function _parseTableSizes($reset = false)
{
if ($reset) $this->_resetSizes();
$this->line_size = count($this->tbody);
foreach (self::$_table_parts as $part) {
- 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 generateUrl
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function generateUrl($route_infos, $base_uri = null, $hash = null, $separator = '&')
{
$url_args = $this->getArgumentsMap()->getCollection();
$url = $base_uri;
- 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 organizeArguments
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function organizeArguments($method_name = null, $arguments = null, $class_name = null, &$logs = array())
{
if (empty($method_name)) {
return;
}
Function __getMethods
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private function __getMethods($object)
{
$reflection = new ReflectionClass($object);
//get all methods
- 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 findBuilder
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function findBuilder($name, $flag = self::ERROR_ON_FAILURE, array &$logs = array())
{
$this->flag($flag);
$cc_name = array(TextHelper::toCamelCase($name));
if (!$this->_findClasses($cc_name)) {
Method build
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function build($name, array $parameters = null, $flag = self::ERROR_ON_FAILURE, array &$logs = array())
{
$this->flag($flag);
$object = null;
$builder_class_name = $this->findBuilder($name, $flag, $logs);
Pagination
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class Pagination
implements \Iterator
{
/**
Function getRequestUrl
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public static function getRequestUrl($entities = false, $base = false, $no_file = false, $no_rewrite = false)
{
$protocol = self::getHttpProtocol();
if ($no_rewrite) {
$url = $protocol.'://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
- 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
File Cookie.php
has 272 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* This file is part of the Library package.
*
* Copyleft (ↄ) 2013-2016 Pierre Cassat <me@e-piwi.fr> and contributors