Laravelium/laravel-feed

View on GitHub

Showing 151 of 151 total issues

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

Suspicious array access to \Illuminate\Contracts\Container\Container
Open

                'response' => $app[ResponseFactory::class],

Variable $namespaces is undeclared
Open

<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:webfeeds="http://webfeeds.org/rss/1.0" xmlns:media="http://search.yahoo.com/mrss/"<?php foreach ($namespaces as $n) {
Severity: Minor
Found in src/views/rss.blade.php by phan

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.

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

Reference to undeclared property \Laravelium\Feed\FeedServiceProvider->app
Open

        $this->app->bind('feed', function (Container $app) {

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

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

    ], 'config');

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.

Severity
Category
Status
Source
Language