Laravelium/laravel-feed

View on GitHub

Showing 151 of 151 total issues

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

Class implements undeclared interface \Illuminate\Contracts\Support\DeferrableProvider
Open

class FeedServiceProvider extends ServiceProvider implements DeferrableProvider

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

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 undeclared method \Laravelium\Feed\FeedServiceProvider::publishes
Open

        $this->publishes([

Call to undeclared function \base_path()
Open

      __DIR__ . '/../../views' => base_path('resources/views/vendor/feed')

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

                'files' => $app['files'],

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

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.

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 undeclared method \Laravelium\Feed\FeedServiceProvider::loadViewsFrom
Open

        $this->loadViewsFrom(__DIR__ . '/../../views', 'feed');

Reference to constant class from undeclared class \Illuminate\Contracts\Routing\ResponseFactory
Open

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

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

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

                'view' => $app['view']

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.

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
Severity
Category
Status
Source
Language