Laravelium/laravel-feed

View on GitHub

Showing 151 of 151 total issues

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

      '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

      'items'     => $this->items,
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

      $config_file => config_path('feed.php')

The variable $config_file is not named in camelCase.
Open

    public function boot()
    {
        $this->loadViewsFrom(__DIR__ . '/../../views', 'feed');

        $this->publishes([

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $config_file is not named in camelCase.
Open

    public function boot()
    {
        $this->loadViewsFrom(__DIR__ . '/../../views', 'feed');

        $this->publishes([

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $config_file is not named in camelCase.
Open

    public function boot()
    {
        $this->loadViewsFrom(__DIR__ . '/../../views', 'feed');

        $this->publishes([

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

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

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

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.

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

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

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