Laravelium/laravel-feed

View on GitHub
src/Laravelium/Feed/Feed.php

Summary

Maintainability
B
5 hrs
Test Coverage

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

    Function addItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function addItem(array $item)
        {
            // if is multidimensional
            if (array_key_exists(1, $item)) {
                foreach ($item as $i) {
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php - About 25 mins 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 method render() has an NPath complexity of 36864. The configured NPath complexity threshold is 200.
    Open

        public function render($format = null, $cache = null, $key = null)
        {
            if (null === $format) {
                $format = "atom";
            }
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpmd

    NPathComplexity

    Since: 0.1

    The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

    Example

    class Foo {
        function bar() {
            // lots of complicated code
        }
    }

    Source https://phpmd.org/rules/codesize.html#npathcomplexity

    The method render() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10.
    Open

        public function render($format = null, $cache = null, $key = null)
        {
            if (null === $format) {
                $format = "atom";
            }
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpmd

    CyclomaticComplexity

    Since: 0.1

    Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

    Example

    // Cyclomatic Complexity = 11
    class Foo {
    1   public function example() {
    2       if ($a == $b) {
    3           if ($a1 == $b1) {
                    fiddle();
    4           } elseif ($a2 == $b2) {
                    fiddle();
                } else {
                    fiddle();
                }
    5       } elseif ($c == $d) {
    6           while ($c == $d) {
                    fiddle();
                }
    7        } elseif ($e == $f) {
    8           for ($n = 0; $n < $h; $n++) {
                    fiddle();
                }
            } else {
                switch ($z) {
    9               case 1:
                        fiddle();
                        break;
    10              case 2:
                        fiddle();
                        break;
    11              case 3:
                        fiddle();
                        break;
                    default:
                        fiddle();
                        break;
                }
            }
        }
    }

    Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

    Refactor this function to reduce its Cognitive Complexity from 21 to the 15 allowed.
    Open

        public function render($format = null, $cache = null, $key = null)
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by sonar-php

    Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

    See

    The method setShortening has a boolean flag argument $b, which is a certain sign of a Single Responsibility Principle violation.
    Open

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

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

    Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

    The method render uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $view = 'feed::'.$format;
            }
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpmd

    ElseExpression

    Since: 1.4.0

    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($flag) {
                // one branch
            } else {
                // another branch
            }
        }
    }

    Source https://phpmd.org/rules/cleancode.html#elseexpression

    The method render uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                // if cache is 0 delete the key (if exists) and return response
                $this->clearCache();
    
                return $this->response->make($this->view->make($view, $viewData), 200, ['Content-Type' => $ctype.'; charset='.$this->charset]);
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpmd

    ElseExpression

    Since: 1.4.0

    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($flag) {
                // one branch
            } else {
                // another branch
            }
        }
    }

    Source https://phpmd.org/rules/cleancode.html#elseexpression

    The method formatDate uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                // datetime
                $date = ('atom' == $format) ? date('c', strtotime($date)) : date('D, d M Y H:i:s O', strtotime($date));
            }
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpmd

    ElseExpression

    Since: 1.4.0

    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($flag) {
                // one branch
            } else {
                // another branch
            }
        }
    }

    Source https://phpmd.org/rules/cleancode.html#elseexpression

    The method render uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $ctype = ($format == 'atom') ? 'application/atom+xml' : 'application/rss+xml';
            }
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpmd

    ElseExpression

    Since: 1.4.0

    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($flag) {
                // one branch
            } else {
                // another branch
            }
        }
    }

    Source https://phpmd.org/rules/cleancode.html#elseexpression

    Rename "$ctype" which has the same name as the field declared at line 145.
    Open

                $ctype = $this->ctype;
    Severity: Major
    Found in src/Laravelium/Feed/Feed.php by sonar-php

    Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.

    Noncompliant Code Example

    class Foo {
      public $myField;
    
      public function doSomething() {
        $myField = 0;
        ...
      }
    }
    

    See

    Define a constant instead of duplicating this literal "; charset=" 3 times.
    Open

                return $this->response->make($this->cache->get($this->cacheKey), 200, ['Content-Type' => $this->cache->get($this->cacheKey."_ctype").'; charset='.$this->charset]);
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Define a constant instead of duplicating this literal "_ctype" 3 times.
    Open

                return $this->response->make($this->cache->get($this->cacheKey), 200, ['Content-Type' => $this->cache->get($this->cacheKey."_ctype").'; charset='.$this->charset]);
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Define a constant instead of duplicating this literal "description" 4 times.
    Open

                $append = (strlen($item['description']) > $this->shorteningLimit) ? '...' : '';
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Rename "$view" which has the same name as the field declared at line 55.
    Open

                $view = $this->customView;
    Severity: Major
    Found in src/Laravelium/Feed/Feed.php by sonar-php

    Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.

    Noncompliant Code Example

    class Foo {
      public $myField;
    
      public function doSomething() {
        $myField = 0;
        ...
      }
    }
    

    See

    Define a constant instead of duplicating this literal "title" 4 times.
    Open

            if (isset($item['title'])) {
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Define a constant instead of duplicating this literal "Content-Type" 3 times.
    Open

                return $this->response->make($this->cache->get($this->cacheKey), 200, ['Content-Type' => $this->cache->get($this->cacheKey."_ctype").'; charset='.$this->charset]);
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Define a constant instead of duplicating this literal "D, d M Y H:i:s O" 4 times.
    Open

                $this->pubdate = date('D, d M Y H:i:s O');
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Define a constant instead of duplicating this literal "UTF-8" 5 times.
    Open

                $item['description'] = mb_substr($item['description'], 0, $this->shorteningLimit, 'UTF-8') . $append;
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Define a constant instead of duplicating this literal "subtitle" 4 times.
    Open

            if (isset($item['subtitle'])) {
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Call to method put from undeclared class \Illuminate\Contracts\Cache\Repository
    Open

                $this->cache->put($this->cacheKey."_ctype", $ctype, $this->caching);
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by phan

    Call to method make from undeclared class \Illuminate\Contracts\Routing\ResponseFactory
    Open

                return $this->response->make($this->cache->get($this->cacheKey), 200, ['Content-Type' => $this->cache->get($this->cacheKey."_ctype").'; charset='.$this->charset]);
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by phan

    Saw possibly unextractable annotation for a fragment of comment '* @param string/integer $date': after string, did not see an element name (will guess based on comment order)
    Open

         * @param string/integer $date
    Severity: Info
    Found in src/Laravelium/Feed/Feed.php by phan

    Call to method get from undeclared class \Illuminate\Contracts\Config\Repository
    Open

                $this->link = $this->configRepository->get('application.url');
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by phan

    Property \Laravelium\Feed\Feed->response has undeclared type \Illuminate\Contracts\Routing\ResponseFactory
    Open

        protected $response = null;
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phan

    Call to method make from undeclared class \Illuminate\Contracts\Routing\ResponseFactory
    Open

                return $this->response->make($this->view->make($view, $viewData), 200, ['Content-Type' => $ctype.'; charset='.$this->charset]);
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by phan

    Property \Laravelium\Feed\Feed->view has undeclared type \Illuminate\Contracts\View\Factory
    Open

        protected $view = null;
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phan

    Property \Laravelium\Feed\Feed->file has undeclared type \Illuminate\Filesystem\Filesystem
    Open

        protected $file = null;
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phan

    Call to method make from undeclared class \Illuminate\Contracts\Routing\ResponseFactory
    Open

                return $this->response->make($this->cache->get($this->cacheKey), 200, ['Content-Type' => $this->cache->get($this->cacheKey."_ctype").'; charset='.$this->charset]);
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by phan

    Call to method has from undeclared class \Illuminate\Contracts\Cache\Repository
    Open

            if (0 < $this->caching && $this->cache->has($this->cacheKey)) {
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by phan

    Call to method make from undeclared class \Illuminate\Contracts\View\Factory
    Open

                return $this->response->make($this->view->make($view, $viewData), 200, ['Content-Type' => $ctype.'; charset='.$this->charset]);
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by phan

    Returning type int but getCacheDuration() is declared to return string
    Open

            return $this->caching;
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phan

    Parameter $cache has undeclared type \Laravelium\Feed\datetime (Did you mean class \DateTime)
    Open

        public function render($format = null, $cache = null, $key = null)
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phan

    Returning type string but getCustomView() is declared to return void
    Open

            return $this->customView;
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phan

    Property \Laravelium\Feed\Feed->configRepository has undeclared type \Illuminate\Contracts\Config\Repository
    Open

        protected $configRepository = null;
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phan

    Returning type string but getDateFormat() is declared to return void
    Open

            return $this->dateFormat;
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phan

    Property \Laravelium\Feed\Feed->cache has undeclared type \Illuminate\Contracts\Cache\Repository
    Open

        public $cache = null;
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phan

    Call to method forget from undeclared class \Illuminate\Contracts\Cache\Repository
    Open

                $this->cache->forget($this->cacheKey);
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by phan

    Saw an @param annotation for format, but the param list of function getDateFormat() : void is empty
    Open

         * @param string $format
    Severity: Info
    Found in src/Laravelium/Feed/Feed.php by phan

    Call to method put from undeclared class \Illuminate\Contracts\Cache\Repository
    Open

                $this->cache->put($this->cacheKey, $this->view->make($view, $viewData)->render(), $this->caching);
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by phan

    Saw an @param annotation for a, but it was not found in the param list of function addItem(array $item) : void
    Open

         * @param array $a
    Severity: Info
    Found in src/Laravelium/Feed/Feed.php by phan

    Call to undeclared function \request()
    Open

            $rssLink = (!empty($this->domain)) ? sprintf('%s/%s', rtrim($this->domain, '/'), ltrim(request()->path(), '/')) : request()->url();
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by phan

    Call to method get from undeclared class \Illuminate\Contracts\Config\Repository
    Open

                $this->lang = $this->configRepository->get('application.language');
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by phan

    Call to method toDateTimeString on non-class type string
    Open

                $date = ('atom' == $format) ? date('c', strtotime($date->toDateTimeString())) : date('D, d M Y H:i:s O', strtotime($date->toDateTimeString()));
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by phan

    Call to method has from undeclared class \Illuminate\Contracts\Cache\Repository
    Open

            if ($this->cache->has($this->cacheKey)) {
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by phan

    Call to method get from undeclared class \Illuminate\Contracts\Cache\Repository
    Open

                return $this->response->make($this->cache->get($this->cacheKey), 200, ['Content-Type' => $this->cache->get($this->cacheKey."_ctype").'; charset='.$this->charset]);
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by phan

    Call to method make from undeclared class \Illuminate\Contracts\View\Factory
    Open

                $this->cache->put($this->cacheKey, $this->view->make($view, $viewData)->render(), $this->caching);
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by phan

    Parameter $cache has undeclared type \Laravelium\Feed\carbon
    Open

        public function render($format = null, $cache = null, $key = null)
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phan

    Return type of render() is undeclared type \Laravelium\Feed\view
    Open

        public function render($format = null, $cache = null, $key = null)
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phan

    Saw a token Phan may have failed to parse after '* @param string/integer $date': after string, saw '/'
    Open

         * @param string/integer $date
    Severity: Info
    Found in src/Laravelium/Feed/Feed.php by phan

    Call to method get from undeclared class \Illuminate\Contracts\Cache\Repository
    Open

                return $this->response->make($this->cache->get($this->cacheKey), 200, ['Content-Type' => $this->cache->get($this->cacheKey."_ctype").'; charset='.$this->charset]);
    Severity: Critical
    Found in src/Laravelium/Feed/Feed.php by phan

    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 $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

    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

    Blank line found at start of control structure
    Open

            if (0 < $this->caching) {
    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 "$lang"; 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 default value and equals sign for argument "$format"; expected 1 but found 0
    Open

        public function setDateFormat($format="datetime")
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.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 "$title" 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 default value and equals sign for argument "$title"; 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 default value and equals sign for argument "$b"; 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 "$view" and equals sign; expected 1 but found 0
    Open

        public function setCustomView($view=null)
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.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 default value and equals sign for argument "$key"; 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 "$format"; expected 1 but found 0
    Open

        public function formatDate($date, $format='atom')
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Incorrect spacing between default value and equals sign for argument "$type"; 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 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

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

        public function setCustomView($view=null)
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Incorrect spacing between argument "$lang" 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 "$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 "$format" and equals sign; expected 1 but found 0
    Open

        public function formatDate($date, $format='atom')
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Incorrect spacing between default value and equals sign for argument "$l"; 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

    Line exceeds 120 characters; contains 175 characters
    Open

                return $this->response->make($this->cache->get($this->cacheKey), 200, ['Content-Type' => $this->cache->get($this->cacheKey."_ctype").'; charset='.$this->charset]);
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line exceeds 120 characters; contains 139 characters
    Open

                return $this->response->make($this->view->make($view, $viewData), 200, ['Content-Type' => $ctype.'; charset='.$this->charset]);
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line exceeds 120 characters; contains 139 characters
    Open

            $rssLink = (!empty($this->domain)) ? sprintf('%s/%s', rtrim($this->domain, '/'), ltrim(request()->path(), '/')) : request()->url();
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line exceeds 120 characters; contains 155 characters
    Open

                $date = ('atom' == $format) ? date('c', strtotime($date->toDateTimeString())) : date('D, d M Y H:i:s O', strtotime($date->toDateTimeString()));
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line exceeds 120 characters; contains 123 characters
    Open

                $date = ('atom' == $format) ? date('c', strtotime('@'.$date)) : date('D, d M Y H:i:s O', strtotime('@'.$date));
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line exceeds 120 characters; contains 175 characters
    Open

                return $this->response->make($this->cache->get($this->cacheKey), 200, ['Content-Type' => $this->cache->get($this->cacheKey."_ctype").'; charset='.$this->charset]);
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line indented incorrectly; expected at least 8 spaces, found 4
    Open

        ];
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line indented incorrectly; expected at least 8 spaces, found 4
    Open

        ];
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line indented incorrectly; expected at least 8 spaces, found 6
    Open

          'related'     =>  $this->related,
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line indented incorrectly; expected at least 8 spaces, found 6
    Open

          'channel'     => $channel,
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line indented incorrectly; expected at least 8 spaces, found 6
    Open

          'copyright'   =>  $this->copyright
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line indented incorrectly; expected at least 8 spaces, found 6
    Open

          'logo'      =>  $this->logo,
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line indented incorrectly; expected at least 8 spaces, found 6
    Open

          'cover'     =>  $this->cover,
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line indented incorrectly; expected at least 8 spaces, found 6
    Open

          'description'   =>  $this->description,
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line indented incorrectly; expected at least 8 spaces, found 6
    Open

          'color'     =>  $this->color,
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line indented incorrectly; expected at least 8 spaces, found 6
    Open

          'title'     =>  htmlspecialchars(strip_tags($this->title), ENT_COMPAT, 'UTF-8'),
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line indented incorrectly; expected at least 8 spaces, found 6
    Open

          'ref'       =>  $this->ref,
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line indented incorrectly; expected at least 8 spaces, found 6
    Open

          'link'      =>  $this->link,
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line indented incorrectly; expected at least 8 spaces, found 6
    Open

          'pubdate'     =>  $this->formatDate($this->pubdate, $format),
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line indented incorrectly; expected at least 8 spaces, found 6
    Open

          'items'     => $this->items,
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line indented incorrectly; expected at least 8 spaces, found 6
    Open

          'ga'      =>  $this->ga,
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line indented incorrectly; expected at least 8 spaces, found 6
    Open

          'icon'      =>  $this->icon,
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line indented incorrectly; expected at least 8 spaces, found 6
    Open

          'rssLink'     =>  $rssLink,
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line indented incorrectly; expected at least 8 spaces, found 6
    Open

          'subtitle'    =>  htmlspecialchars(strip_tags($this->subtitle), ENT_COMPAT, 'UTF-8'),
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line indented incorrectly; expected at least 8 spaces, found 6
    Open

          'namespaces'  => $this->namespaces
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    Line indented incorrectly; expected at least 8 spaces, found 6
    Open

          'lang'      =>  $this->lang,
    Severity: Minor
    Found in src/Laravelium/Feed/Feed.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status