src/Http/Resources/TrainerInterestResource.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 TrainerInterestResource extends JsonResource
- Exclude checks
Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerInterestResource->resource
Open
Open
'slug' => $this->resource->slug,
- Exclude checks
Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerInterestResource->resource
Open
Open
'name_with_breadcrumbs' => $this->resource->name_with_breadcrumbs,
- Exclude checks
Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerInterestResource->resource
Open
Open
'icon' => $this->resource->icon ? Storage::url($this->resource->icon) : null,
- Exclude checks
Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerInterestResource->resource
Open
Open
'created_at' => $this->resource->created_at,
- Exclude checks
Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerInterestResource->resource
Open
Open
'updated_at' => $this->resource->updated_at,
- Exclude checks
Call to method url
from undeclared class \Illuminate\Support\Facades\Storage
Open
Open
'icon' => $this->resource->icon ? Storage::url($this->resource->icon) : null,
- Exclude checks
Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerInterestResource->resource
Open
Open
'icon_class' => $this->resource->icon_class,
- Exclude checks
Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerInterestResource->resource
Open
Open
'parent_id' => $this->resource->parent_id,
- Exclude checks
Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerInterestResource->resource
Open
Open
'name' => $this->resource->name,
- Exclude checks
Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerInterestResource->resource
Open
Open
'is_active' => $this->resource->is_active,
- Exclude checks
Reference to undeclared property \EscolaLms\Webinar\Http\Resources\TrainerInterestResource->resource
Open
Open
'id' => $this->resource->id,
- Exclude checks
Avoid using static access to class '\Illuminate\Support\Facades\Storage' in method 'toArray'. Open
Open
'icon' => $this->resource->icon ? Storage::url($this->resource->icon) : null,
- 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();
}
}