Laravelium/laravel-feed

View on GitHub

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

class Feed
{
    const DEFAULT_REF = 'self';

    /**
Severity: Minor
Found in src/Laravelium/Feed/Feed.php by phpmd

Method render has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function render($format = null, $cache = null, $key = null)
    {
        if (null === $format) {
            $format = "atom";
        }
Severity: Major
Found in src/Laravelium/Feed/Feed.php - About 2 hrs to fix

    Function render has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function render($format = null, $cache = null, $key = null)
        {
            if (null === $format) {
                $format = "atom";
            }
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php - About 2 hrs to fix

    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

    class Feed
    {
        const DEFAULT_REF = 'self';
    
        /**
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpmd

    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 $ga. Configured minimum length is 3.
    Open

        public $ga;
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpmd

    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 $b. Configured minimum length is 3.
    Open

        public function setShortening($b=false)
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpmd

    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

        public function setTextLimit($l=150)
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpmd

    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

    Spaces must be used for alignment; tabs are not allowed
    Open

        'escaping'            =>     true,
    Severity: Minor
    Found in src/config/config.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

        'use_limit_size'    =>     false,
    Severity: Minor
    Found in src/config/config.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

        'cache_key'            =>     'laravel-feed.' . config('app.url'),
    Severity: Minor
    Found in src/config/config.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

        'cache_duration'    =>     3600,
    Severity: Minor
    Found in src/config/config.php by phpcodesniffer

    Incorrect spacing between argument "$duration" and equals sign; expected 1 but found 0
    Open

        public function setCache($duration=60, $key="laravel-feed")
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Incorrect spacing between argument "$l" and equals sign; expected 1 but found 0
    Open

        public function setTextLimit($l=150)
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Incorrect spacing between argument "$b" and equals sign; expected 1 but found 0
    Open

        public function setShortening($b=false)
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Incorrect spacing between argument "$format" and equals sign; expected 1 but found 0
    Open

        public function setDateFormat($format="datetime")
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

        'cache_duration'    =>     3600,
    Severity: Minor
    Found in src/config/config.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

        'escaping'            =>     true,
    Severity: Minor
    Found in src/config/config.php by phpcodesniffer

    Incorrect spacing between argument "$type" and equals sign; expected 1 but found 0
    Open

        public static function link($url, $type='atom', $title=null, $lang=null)
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Incorrect spacing between argument "$key" and equals sign; expected 1 but found 0
    Open

        public function setCache($duration=60, $key="laravel-feed")
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Incorrect spacing between default value and equals sign for argument "$duration"; expected 1 but found 0
    Open

        public function setCache($duration=60, $key="laravel-feed")
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer
    Severity
    Category
    Status
    Source
    Language