src/Http/Controllers/CourseExportImportAPIController.php
Avoid unused parameters such as '$request'. Open
Open
public function export(int $course_id, GetCourseExportAPIRequest $request): JsonResponse
- 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
Avoid unused parameters such as '$course_id'. Open
Open
public function clone(int $course_id, CloneCourseAPIRequest $request): JsonResponse
- 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
Avoid using static access to class '\EscolaLms\Courses\Http\Resources\CourseSimpleResource' in method 'import'. Open
Open
CourseSimpleResource::make($course),
- 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
The parameter $course_id is not named in camelCase. Open
Open
public function clone(int $course_id, CloneCourseAPIRequest $request): JsonResponse
{
$this->cloneCourseService->clone($request->getCourse());
return $this->sendSuccess(__('Course cloning started. This may take a while.'));
}
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $course_id is not named in camelCase. Open
Open
public function export(int $course_id, GetCourseExportAPIRequest $request): JsonResponse
{
$export = $this->exportImportService->export($course_id);
return $this->sendResponse($export, __('Export created'));
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The variable $course_id is not named in camelCase. Open
Open
public function export(int $course_id, GetCourseExportAPIRequest $request): JsonResponse
{
$export = $this->exportImportService->export($course_id);
return $this->sendResponse($export, __('Export created'));
- 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();
}
}