Laravelium/laravel-feed

View on GitHub

Showing 151 of 151 total issues

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

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

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

Variable $namespaces is undeclared
Open

<feed xmlns="http://www.w3.org/2005/Atom"<?php foreach ($namespaces as $n) {
Severity: Minor
Found in src/views/atom.blade.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

Call to undeclared method \Laravelium\Feed\FeedServiceProvider::mergeConfigFrom
Open

        $this->mergeConfigFrom($config_file, 'feed');

Call to undeclared method \Laravelium\Feed\FeedServiceProvider::publishes
Open

        $this->publishes([

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.

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 "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.

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 "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.

Severity
Category
Status
Source
Language