src/Http/Resources/TrainerResource.php
Avoid unused parameters such as '$request'. Open
Open
public function toArray($request)
- 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
Class extends undeclared class \Illuminate\Http\Resources\Json\JsonResource
Open
Open
class TrainerResource extends JsonResource
- Exclude checks
Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerResource->resource
Open
Open
'last_name' => $this->resource->last_name,
- Exclude checks
Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerResource->resource
Open
Open
'path_avatar' => $this->resource->path_avatar,
- Exclude checks
Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerResource->resource
Open
Open
'url_avatar' => $this->resource->avatar_url,
- Exclude checks
Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerResource->resource
Open
Open
['categories' => $this->resource->categories],
- Exclude checks
Static call to undeclared method \EscolaLms\Webinar\Http\Resources\TrainerInterestResource::collection
Open
Open
'interests' => TrainerInterestResource::collection($this->resource->interests),
- Exclude checks
Reference to constant PUBLIC
from undeclared class \EscolaLms\ModelFields\Enum\MetaFieldVisibilityEnum
Open
Open
ModelFields::getExtraAttributesValues($this->resource, MetaFieldVisibilityEnum::PUBLIC)
- Exclude checks
Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerResource->resource
Open
Open
ModelFields::getExtraAttributesValues($this->resource, MetaFieldVisibilityEnum::PUBLIC)
- Exclude checks
Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerResource->resource
Open
Open
'first_name' => $this->resource->first_name,
- Exclude checks
Call to method getExtraAttributesValues
from undeclared class \EscolaLms\ModelFields\Facades\ModelFields
Open
Open
ModelFields::getExtraAttributesValues($this->resource, MetaFieldVisibilityEnum::PUBLIC)
- Exclude checks
Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerResource->resource
Open
Open
'interests' => TrainerInterestResource::collection($this->resource->interests),
- Exclude checks
Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerResource->resource
Open
Open
'id' => $this->resource->id,
- Exclude checks
Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerResource->resource
Open
Open
'email' => $this->resource->email,
- Exclude checks
Avoid using static access to class '\EscolaLms\ModelFields\Facades\ModelFields' in method 'toArray'. Open
Open
ModelFields::getExtraAttributesValues($this->resource, MetaFieldVisibilityEnum::PUBLIC)
- 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
Avoid using static access to class 'EscolaLms\Webinar\Http\Resources\TrainerInterestResource' in method 'toArray'. Open
Open
'interests' => TrainerInterestResource::collection($this->resource->interests),
- 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();
}
}