chamilo/chamilo-lms

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

Summary

Maintainability
A
0 mins
Test Coverage

The method about() has an NPath complexity of 492. The configured NPath complexity threshold is 200.
Open

    public function about(
        Request $request,
        Session $session,
        IllustrationRepository $illustrationRepo,
        UserRepository $userRepo,

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

Avoid using undefined variables such as '$htmlHeadXtra' which will lead to PHP notices.
Open

        $htmlHeadXtra[] = api_get_asset('readmore-js/readmore.js');

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

The class SessionController has a coupling between objects value of 17. Consider to reduce the number of dependencies under 13.
Open

class SessionController extends AbstractController
{
    /**
     * @Entity("session", expr="repository.find(sid)")
     */

CouplingBetweenObjects

Since: 1.1.0

A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

Example

class Foo {
    /**
     * @var \foo\bar\X
     */
    private $x = null;

    /**
     * @var \foo\bar\Y
     */
    private $y = null;

    /**
     * @var \foo\bar\Z
     */
    private $z = null;

    public function setFoo(\Foo $foo) {}
    public function setBar(\Bar $bar) {}
    public function setBaz(\Baz $baz) {}

    /**
     * @return \SplObjectStorage
     * @throws \OutOfRangeException
     * @throws \InvalidArgumentException
     * @throws \ErrorException
     */
    public function process(\Iterator $it) {}

    // ...
}

Source https://phpmd.org/rules/design.html#couplingbetweenobjects

Avoid unused local variables such as '$sequenceResourceRepo'.
Open

        $sequenceResourceRepo = $em->getRepository(SequenceResource::class);

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid unused local variables such as '$htmlHeadXtra'.
Open

        $htmlHeadXtra[] = api_get_asset('readmore-js/readmore.js');

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

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

    #[Route(path: '/{sid}/about', name: 'chamilo_core_session_about')]

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

class SessionController extends AbstractController

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('/sessions')]

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

    public function about(

There are no issues that match your filters.

Category
Status