Laravelium/laravel-feed

View on GitHub

Showing 151 of 151 total issues

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

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

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

Closing brace indented incorrectly; expected 205 spaces, found 0
Open

} ?>>
Severity: Minor
Found in src/views/rss.blade.php by phpcodesniffer

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

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

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

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

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

Parameter $app has undeclared type \Illuminate\Contracts\Container\Container
Open

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

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

                'cache' => $app['Illuminate\Cache\Repository'],

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.

Severity
Category
Status
Source
Language