chamilo/chamilo-lms

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

Summary

Maintainability
A
0 mins
Test Coverage

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

class ResetPasswordController extends AbstractController
{
    use ResetPasswordControllerTrait;

    private ResetPasswordHelperInterface $resetPasswordHelper;

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 assigning values to variables in if clauses and the like (line '69', column '23').
Open

    public function checkEmail(): Response
    {
        // Generate a fake token if the user does not exist or someone hit this page directly.
        // This prevents exposing whether or not a user was found with the given email address or not
        if (null === ($resetToken = $this->getTokenObjectFromSession())) {

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

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

    public function request(Request $request, MailerInterface $mailer): Response

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

class ResetPasswordController extends AbstractController

Missing function doc comment
Open

    public function __construct(

Add a single space around assignment operators
Open

declare(strict_types=1);

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

    public function reset(Request $request, UserPasswordHasherInterface $passwordHasher, ?string $token = null): Response

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

#[Route('/reset-password')]

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

    public function checkEmail(): Response

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

    #[Route('/reset/{token}', name: 'app_reset_password')]

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

    #[Route('', name: 'app_forgot_password_request')]

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

    #[Route('/check-email', name: 'app_check_email')]

Line indented incorrectly; expected 4 spaces, found 8
Open

        private EntityManagerInterface $entityManager,

Line indented incorrectly; expected 4 spaces, found 8
Open

        private UserRepository $userRepository

There are no issues that match your filters.

Category
Status