chamilo/chamilo-lms

View on GitHub
src/CoreBundle/Controller/IndexController.php

Summary

Maintainability
A
0 mins
Test Coverage

The method toggleStudentView uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $content = 'studentview';
        }

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[Route('/sessions', name: 'sessions')]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[Route('/p/{slug}', name: 'public_page')]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[Route('/toggle_student_view', methods: ['GET'])]

Missing class doc comment
Open

class IndexController extends BaseController

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[Route('/', name: 'index', options: ['expose' => true], methods: ['GET', 'POST'])]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[Route('/admin', name: 'admin', options: ['expose' => true])]

You must use "/**" style comments for a function comment
Open

    public function toggleStudentView(Request $request, SettingsManager $settingsManager): Response

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[Route('/sessions/{extra}', name: 'sessions_options')]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[Route('/admin/configuration/colors', name: 'configuration_colors')]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[Route('/resources/document/{nodeId}/manager', name: 'resources_filemanager', methods: ['GET'])]

You must use "/**" style comments for a function comment
Open

    public function index(): Response

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[Security("is_granted('ROLE_TEACHER')")]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[Route('/faq', name: 'faq', options: ['expose' => true], methods: ['GET', 'POST'])]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[Route('/home', name: 'home', options: ['expose' => true], methods: ['GET', 'POST'])]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[Route('/login', name: 'login', options: ['expose' => true], methods: ['GET', 'POST'])]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[Route('/demo', name: 'demo', options: ['expose' => true], methods: ['GET', 'POST'])]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[Route('/account/home', name: 'chamilo_core_account_home', options: ['expose' => true])]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[Route('/courses', name: 'courses', options: ['expose' => true], methods: ['GET', 'POST'])]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[Route('/catalogue/{slug}', name: 'catalogue', options: ['expose' => true], methods: ['GET', 'POST'])]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[Route('/social', name: 'chamilo_core_socialnetwork', options: ['expose' => true])]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[Route('/course/{cid}/home', name: 'chamilo_core_course_home')]

Add a single space around assignment operators
Open

declare(strict_types=1);

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[Route('/resources/ccalendarevent', name: 'resources_ccalendarevent', methods: ['GET'])]

There are no issues that match your filters.

Category
Status