EscolaLMS/Courses-Import-Export

View on GitHub
src/Http/Controllers/CourseExportImportAPIController.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

Avoid using static access to class '\EscolaLms\Courses\Http\Resources\CourseSimpleResource' in method 'import'.
Open

                CourseSimpleResource::make($course),

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 unused parameters such as '$request'.
Open

    public function export(int $course_id, GetCourseExportAPIRequest $request): JsonResponse

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

    public function clone(int $course_id, CloneCourseAPIRequest $request): JsonResponse

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

The parameter $course_id is not named in camelCase.
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.'));
    }

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

    public function export(int $course_id, GetCourseExportAPIRequest $request): JsonResponse
    {
        $export = $this->exportImportService->export($course_id);

        return $this->sendResponse($export, __('Export created'));

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

    public function export(int $course_id, GetCourseExportAPIRequest $request): JsonResponse
    {
        $export = $this->exportImportService->export($course_id);

        return $this->sendResponse($export, __('Export created'));

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