Showing 151 of 151 total issues
The class Feed has an overall complexity of 52 which is very high. The configured complexity threshold is 50. Open
Open
class Feed
{
const DEFAULT_REF = 'self';
/**
- Exclude checks
Method render
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function render($format = null, $cache = null, $key = null)
{
if (null === $format) {
$format = "atom";
}
Function render
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
Open
public function render($format = null, $cache = null, $key = null)
{
if (null === $format) {
$format = "atom";
}
- 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
The class Feed has 31 fields. Consider redesigning Feed to keep the number of fields under 15. Open
Open
class Feed
{
const DEFAULT_REF = 'self';
/**
- Read upRead up
- Exclude checks
TooManyFields
Since: 0.1
Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.
Example
class Person {
protected $one;
private $two;
private $three;
[... many more fields ...]
}
Source https://phpmd.org/rules/codesize.html#toomanyfields
Avoid variables with short names like $b. Configured minimum length is 3. Open
Open
public function setShortening($b=false)
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $ga. Configured minimum length is 3. Open
Open
public $ga;
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $l. Configured minimum length is 3. Open
Open
public function setTextLimit($l=150)
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Incorrect spacing between default value and equals sign for argument "$duration"; expected 1 but found 0 Open
Open
public function setCache($duration=60, $key="laravel-feed")
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
'use_cache' => false,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
'escaping' => true,
- Exclude checks
Incorrect spacing between default value and equals sign for argument "$l"; expected 1 but found 0 Open
Open
public function setTextLimit($l=150)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
'use_limit_size' => false,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
'max_size' => null,
- Exclude checks
Incorrect spacing between argument "$type" and equals sign; expected 1 but found 0 Open
Open
public static function link($url, $type='atom', $title=null, $lang=null)
- Exclude checks
Incorrect spacing between default value and equals sign for argument "$type"; expected 1 but found 0 Open
Open
public static function link($url, $type='atom', $title=null, $lang=null)
- Exclude checks
Incorrect spacing between argument "$lang" and equals sign; expected 1 but found 0 Open
Open
public static function link($url, $type='atom', $title=null, $lang=null)
- Exclude checks
Incorrect spacing between default value and equals sign for argument "$view"; expected 1 but found 0 Open
Open
public function setCustomView($view=null)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
'cache_duration' => 3600,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
'styles_location' => null,
- Exclude checks
Incorrect spacing between argument "$duration" and equals sign; expected 1 but found 0 Open
Open
public function setCache($duration=60, $key="laravel-feed")
- Exclude checks