Passed
Push — feature/uploadable ( 7c6d25...a7ed20 )
by Daniel
11:07
created

PasswordRequestAction::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 2
dl 0
loc 9
ccs 0
cts 5
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the Silverback API Components Bundle Project
5
 *
6
 * (c) Daniel West <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Silverback\ApiComponentsBundle\Action\User;
15
16
use Symfony\Component\HttpFoundation\Request;
17
use Symfony\Component\HttpFoundation\Response;
18
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
19
20
/**
21
 * @author Daniel West <[email protected]>
22
 */
23
class PasswordRequestAction extends AbstractPasswordAction
24
{
25
    public function __invoke(Request $request, string $username): Response
26
    {
27
        try {
28
            $this->passwordManager->requestResetEmail($username);
29
        } catch (NotFoundHttpException $exception) {
30
            return $this->responseFactory->create($request, null, Response::HTTP_NOT_FOUND);
31
        }
32
33
        return $this->responseFactory->create($request);
34
    }
35
}
36