brandon14/brand0n.gg

View on GitHub
app/Jobs/GenerateSocialImagesJob.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid unused local variables such as '$image'.
Open

            $image = Browsershot::url("{$app_url}/social-images/{$id}")
Severity: Minor
Found in app/Jobs/GenerateSocialImagesJob.php by phpmd

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

        $this->items->each(function($item, $key) {
Severity: Minor
Found in app/Jobs/GenerateSocialImagesJob.php by phpmd

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

use Illuminate\Contracts\Queue\ShouldBeUnique;
Severity: Minor
Found in app/Jobs/GenerateSocialImagesJob.php by phan

Class implements undeclared interface \Illuminate\Contracts\Queue\ShouldQueue
Open

class GenerateSocialImagesJob implements ShouldQueue
Severity: Critical
Found in app/Jobs/GenerateSocialImagesJob.php by phan

Call to method of from undeclared class \Illuminate\Support\Str
Open

            $title = Str::of($item->get('title'))->slug('-');
Severity: Critical
Found in app/Jobs/GenerateSocialImagesJob.php by phan

Call to undeclared function \config()
Open

            $app_url = config('app.url');
Severity: Critical
Found in app/Jobs/GenerateSocialImagesJob.php by phan

Call to undeclared function \public_path()
Open

                ->save(public_path("social_images/{$file}"));
Severity: Critical
Found in app/Jobs/GenerateSocialImagesJob.php by phan

Class uses undeclared trait \Illuminate\Foundation\Bus\Dispatchable
Open

class GenerateSocialImagesJob implements ShouldQueue
Severity: Critical
Found in app/Jobs/GenerateSocialImagesJob.php by phan

Class uses undeclared trait \Illuminate\Queue\InteractsWithQueue
Open

class GenerateSocialImagesJob implements ShouldQueue
Severity: Critical
Found in app/Jobs/GenerateSocialImagesJob.php by phan

Call to undeclared function \public_path()
Open

                ->save(public_path("social_images/{$file}"));
Severity: Critical
Found in app/Jobs/GenerateSocialImagesJob.php by phan

Call to method call from undeclared class \Illuminate\Support\Facades\Artisan
Open

        Artisan::call('cache:clear');
Severity: Critical
Found in app/Jobs/GenerateSocialImagesJob.php by phan

Class uses undeclared trait \Illuminate\Bus\Queueable
Open

class GenerateSocialImagesJob implements ShouldQueue
Severity: Critical
Found in app/Jobs/GenerateSocialImagesJob.php by phan

Call to method url from undeclared class \Spatie\Browsershot\Browsershot
Open

            $image = Browsershot::url("{$app_url}/social-images/{$id}")
Severity: Critical
Found in app/Jobs/GenerateSocialImagesJob.php by phan

Class uses undeclared trait \Illuminate\Queue\SerializesModels
Open

class GenerateSocialImagesJob implements ShouldQueue
Severity: Critical
Found in app/Jobs/GenerateSocialImagesJob.php by phan

Call to method url from undeclared class \Spatie\Browsershot\Browsershot
Open

            $image = Browsershot::url("{$app_url}/social-images/{$id}")
Severity: Critical
Found in app/Jobs/GenerateSocialImagesJob.php by phan

Avoid using static access to class '\Illuminate\Support\Facades\Artisan' in method 'handle'.
Open

        Artisan::call('cache:clear');
Severity: Minor
Found in app/Jobs/GenerateSocialImagesJob.php by phpmd

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

        $this->items->each(function($item, $key) {

The variable $app_url is not named in camelCase.
Open

    public function handle()
    {
        $this->items->each(function($item, $key) {
            $id = $item->id();
            $title = Str::of($item->get('title'))->slug('-');
Severity: Minor
Found in app/Jobs/GenerateSocialImagesJob.php by phpmd

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

    public function handle()
    {
        $this->items->each(function($item, $key) {
            $id = $item->id();
            $title = Str::of($item->get('title'))->slug('-');
Severity: Minor
Found in app/Jobs/GenerateSocialImagesJob.php by phpmd

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

    public function handle()
    {
        $this->items->each(function($item, $key) {
            $id = $item->id();
            $title = Str::of($item->get('title'))->slug('-');
Severity: Minor
Found in app/Jobs/GenerateSocialImagesJob.php by phpmd

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

There are no issues that match your filters.

Category
Status