1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Sylius\ShopApiPlugin\Controller\AddressBook; |
6
|
|
|
|
7
|
|
|
use FOS\RestBundle\View\View; |
8
|
|
|
use FOS\RestBundle\View\ViewHandlerInterface; |
9
|
|
|
use JMS\Serializer\SerializerInterface; |
10
|
|
|
use Symfony\Component\HttpFoundation\Request; |
11
|
|
|
use Symfony\Component\HttpFoundation\Response; |
12
|
|
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; |
13
|
|
|
use Symfony\Component\Validator\Validator\ValidatorInterface; |
14
|
|
|
|
15
|
|
|
class UpdateAddressAction |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* @var ViewHandlerInterface |
19
|
|
|
*/ |
20
|
|
|
private $viewHandler; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var TokenStorageInterface |
24
|
|
|
*/ |
25
|
|
|
private $tokenStorage; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var ValidatorInterface |
29
|
|
|
*/ |
30
|
|
|
private $validator; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var SerializerInterface |
34
|
|
|
*/ |
35
|
|
|
private $serializer; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @param ViewHandlerInterface $viewHandler |
39
|
|
|
* @param TokenStorageInterface $tokenStorage |
40
|
|
|
* @param ValidatorInterface $validator |
41
|
|
|
* @param SerializerInterface $serializer |
42
|
|
|
*/ |
43
|
|
|
public function __construct( |
44
|
|
|
ViewHandlerInterface $viewHandler, |
45
|
|
|
TokenStorageInterface $tokenStorage, |
46
|
|
|
ValidatorInterface $validator, |
47
|
|
|
SerializerInterface $serializer |
48
|
|
|
) { |
49
|
|
|
$this->viewHandler = $viewHandler; |
50
|
|
|
$this->tokenStorage = $tokenStorage; |
51
|
|
|
$this->validator = $validator; |
52
|
|
|
$this->serializer = $serializer; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
public function __invoke(Request $request): Response |
56
|
|
|
{ |
57
|
|
|
return $this->viewHandler->handle(View::create([], Response::HTTP_OK)); |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|