EscolaLMS/Webinar

View on GitHub
src/Http/Resources/TrainerResource.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid unused parameters such as '$request'.
Open

    public function toArray($request)

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

Class extends undeclared class \Illuminate\Http\Resources\Json\JsonResource
Open

class TrainerResource extends JsonResource
Severity: Critical
Found in src/Http/Resources/TrainerResource.php by phan

Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerResource->resource
Open

            'last_name' => $this->resource->last_name,
Severity: Minor
Found in src/Http/Resources/TrainerResource.php by phan

Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerResource->resource
Open

            'path_avatar' => $this->resource->path_avatar,
Severity: Minor
Found in src/Http/Resources/TrainerResource.php by phan

Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerResource->resource
Open

            'url_avatar' => $this->resource->avatar_url,
Severity: Minor
Found in src/Http/Resources/TrainerResource.php by phan

Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerResource->resource
Open

            ['categories' => $this->resource->categories],
Severity: Minor
Found in src/Http/Resources/TrainerResource.php by phan

Static call to undeclared method \EscolaLms\Webinar\Http\Resources\TrainerInterestResource::collection
Open

            'interests' => TrainerInterestResource::collection($this->resource->interests),
Severity: Critical
Found in src/Http/Resources/TrainerResource.php by phan

Reference to constant PUBLIC from undeclared class \EscolaLms\ModelFields\Enum\MetaFieldVisibilityEnum
Open

            ModelFields::getExtraAttributesValues($this->resource, MetaFieldVisibilityEnum::PUBLIC)
Severity: Critical
Found in src/Http/Resources/TrainerResource.php by phan

Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerResource->resource
Open

            ModelFields::getExtraAttributesValues($this->resource, MetaFieldVisibilityEnum::PUBLIC)
Severity: Minor
Found in src/Http/Resources/TrainerResource.php by phan

Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerResource->resource
Open

            'first_name' => $this->resource->first_name,
Severity: Minor
Found in src/Http/Resources/TrainerResource.php by phan

Call to method getExtraAttributesValues from undeclared class \EscolaLms\ModelFields\Facades\ModelFields
Open

            ModelFields::getExtraAttributesValues($this->resource, MetaFieldVisibilityEnum::PUBLIC)
Severity: Critical
Found in src/Http/Resources/TrainerResource.php by phan

Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerResource->resource
Open

            'interests' => TrainerInterestResource::collection($this->resource->interests),
Severity: Minor
Found in src/Http/Resources/TrainerResource.php by phan

Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerResource->resource
Open

            'id' => $this->resource->id,
Severity: Minor
Found in src/Http/Resources/TrainerResource.php by phan

Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerResource->resource
Open

            'email' => $this->resource->email,
Severity: Minor
Found in src/Http/Resources/TrainerResource.php by phan

Avoid using static access to class '\EscolaLms\ModelFields\Facades\ModelFields' in method 'toArray'.
Open

            ModelFields::getExtraAttributesValues($this->resource, MetaFieldVisibilityEnum::PUBLIC)

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

Avoid using static access to class 'EscolaLms\Webinar\Http\Resources\TrainerInterestResource' in method 'toArray'.
Open

            'interests' => TrainerInterestResource::collection($this->resource->interests),

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

There are no issues that match your filters.

Category
Status