-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathUsersRouteActionsResource.php
69 lines (60 loc) · 1.68 KB
/
UsersRouteActionsResource.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
/*
* This file is part of Aplus Framework Routing Library.
*
* (c) Natan Felles <natanfelles@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tests\Routing\Support;
use Framework\Routing\Attributes\Origin;
use Framework\Routing\Attributes\Route;
use Framework\Routing\Attributes\RouteNotFound;
use Framework\Routing\ResourceInterface;
use Framework\Routing\RouteActions;
#[Origin('http://domain.com')]
#[Origin('http://api.domain.xyz')]
class UsersRouteActionsResource extends RouteActions implements ResourceInterface
{
#[Route('GET', '/users', origins: 'http://foo.com')]
public function index() : string
{
return __METHOD__;
}
#[Route('POST', '/users')]
public function create() : string
{
return __METHOD__;
}
#[Route('GET', '/users/{int}', '0')]
public function show(string $id) : string
{
return __METHOD__ . '/' . $id;
}
#[Route('PATCH', '/users/{int}', '0')]
public function update(string $id) : string
{
return __METHOD__ . '/' . $id;
}
#[Route('PUT', '/users/{int}', '0')]
public function replace(string $id) : string
{
return __METHOD__ . '/' . $id;
}
#[Route('DELETE', '/users/{int}', '0', 'users.delete')]
public function delete(string $id) : string
{
return __METHOD__ . '/' . $id;
}
#[RouteNotFound]
public function notFoundWithOriginAttributes() : string
{
return __METHOD__;
}
#[RouteNotFound('http://foo.net')]
public function notFoundWithOriginParam() : string
{
return __METHOD__;
}
}