app/Jobs/GenerateSocialImagesJob.php
Avoid unused local variables such as '$image'. Open
Open
$image = Browsershot::url("{$app_url}/social-images/{$id}")
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid unused parameters such as '$key'. Open
Open
$this->items->each(function($item, $key) {
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Possibly zero references to use statement for classlike/namespace ShouldBeUnique
(\Illuminate\Contracts\Queue\ShouldBeUnique)
Open
Open
use Illuminate\Contracts\Queue\ShouldBeUnique;
- Exclude checks
Class implements undeclared interface \Illuminate\Contracts\Queue\ShouldQueue
Open
Open
class GenerateSocialImagesJob implements ShouldQueue
- Exclude checks
Call to method of
from undeclared class \Illuminate\Support\Str
Open
Open
$title = Str::of($item->get('title'))->slug('-');
- Exclude checks
Call to undeclared function \config()
Open
Open
$app_url = config('app.url');
- Exclude checks
Call to undeclared function \public_path()
Open
Open
->save(public_path("social_images/{$file}"));
- Exclude checks
Class uses undeclared trait \Illuminate\Foundation\Bus\Dispatchable
Open
Open
class GenerateSocialImagesJob implements ShouldQueue
- Exclude checks
Class uses undeclared trait \Illuminate\Queue\InteractsWithQueue
Open
Open
class GenerateSocialImagesJob implements ShouldQueue
- Exclude checks
Call to undeclared function \public_path()
Open
Open
->save(public_path("social_images/{$file}"));
- Exclude checks
Call to method call
from undeclared class \Illuminate\Support\Facades\Artisan
Open
Open
Artisan::call('cache:clear');
- Exclude checks
Class uses undeclared trait \Illuminate\Bus\Queueable
Open
Open
class GenerateSocialImagesJob implements ShouldQueue
- Exclude checks
Call to method url
from undeclared class \Spatie\Browsershot\Browsershot
Open
Open
$image = Browsershot::url("{$app_url}/social-images/{$id}")
- Exclude checks
Class uses undeclared trait \Illuminate\Queue\SerializesModels
Open
Open
class GenerateSocialImagesJob implements ShouldQueue
- Exclude checks
Call to method url
from undeclared class \Spatie\Browsershot\Browsershot
Open
Open
$image = Browsershot::url("{$app_url}/social-images/{$id}")
- Exclude checks
Avoid using static access to class '\Illuminate\Support\Facades\Artisan' in method 'handle'. Open
Open
Artisan::call('cache:clear');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Expected 1 space after FUNCTION keyword; 0 found Open
Open
$this->items->each(function($item, $key) {
- Exclude checks
The variable $app_url is not named in camelCase. Open
Open
public function handle()
{
$this->items->each(function($item, $key) {
$id = $item->id();
$title = Str::of($item->get('title'))->slug('-');
- Read upRead up
- Exclude checks
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 $app_url is not named in camelCase. Open
Open
public function handle()
{
$this->items->each(function($item, $key) {
$id = $item->id();
$title = Str::of($item->get('title'))->slug('-');
- Read upRead up
- Exclude checks
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 $app_url is not named in camelCase. Open
Open
public function handle()
{
$this->items->each(function($item, $key) {
$id = $item->id();
$title = Str::of($item->get('title'))->slug('-');
- Read upRead up
- Exclude checks
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();
}
}