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

PasswordRequestAction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 11
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 9 2
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