1 | <?php |
||
12 | class UserController extends BaseController |
||
13 | { |
||
14 | /** @var UserService */ |
||
15 | private $userService; |
||
16 | |||
17 | public function init() |
||
22 | |||
23 | /** |
||
24 | * Fetch user details |
||
25 | * @SWG\Get( |
||
26 | * path="/user/{id}", |
||
27 | * tags={"users"}, |
||
28 | * @SWG\Parameter( |
||
29 | * name="id", |
||
30 | * in="path", |
||
31 | * type="integer", |
||
32 | * description="the type of response", |
||
33 | * required=false, |
||
34 | * default=1 |
||
35 | * ), |
||
36 | * @SWG\Response(response="200", description="Sends user details") |
||
37 | * ) |
||
38 | * |
||
39 | */ |
||
40 | public function indexAction() |
||
52 | |||
53 | /** |
||
54 | * Register as a new user. |
||
55 | * @SWG\Post( |
||
56 | * path="/user/register", |
||
57 | * tags={"users"}, |
||
58 | * @SWG\Response(response="200", description="Registers a new unactivated user"), |
||
59 | * @SWG\Parameter( |
||
60 | * name="email", |
||
61 | * in="formData", |
||
62 | * type="string", |
||
63 | * description="the users email", |
||
64 | * required=true, |
||
65 | * default="[email protected]" |
||
66 | * ), |
||
67 | * @SWG\Parameter( |
||
68 | * name="password", |
||
69 | * in="formData", |
||
70 | * type="string", |
||
71 | * description="a password for the user", |
||
72 | * required=true, |
||
73 | * default="password" |
||
74 | * ), |
||
75 | * @SWG\Parameter( |
||
76 | * name="confirm", |
||
77 | * in="formData", |
||
78 | * type="string", |
||
79 | * description="password confirmation", |
||
80 | * required=true, |
||
81 | * default="password" |
||
82 | * ) |
||
83 | * ) |
||
84 | * @throws Exception |
||
85 | */ |
||
86 | public function registerAction() |
||
124 | |||
125 | |||
126 | |||
127 | /** |
||
128 | * Activate from the email link. |
||
129 | * @SWG\Get( |
||
130 | * path="/user/activate/{email}/{token}", |
||
131 | * tags={"users"}, |
||
132 | * @SWG\Response(response="200", description="Registers a new unactivated user"), |
||
133 | * @SWG\Parameter( |
||
134 | * name="email", |
||
135 | * in="path", |
||
136 | * type="string", |
||
137 | * description="the users email", |
||
138 | * required=true, |
||
139 | * default="[email protected]" |
||
140 | * ), |
||
141 | * @SWG\Parameter( |
||
142 | * name="token", |
||
143 | * in="path", |
||
144 | * type="string", |
||
145 | * description="the email link token", |
||
146 | * required=true, |
||
147 | * default="r4nd0mT0k3n" |
||
148 | * ) |
||
149 | * ) |
||
150 | * @throws Exception |
||
151 | */ |
||
152 | public function activateAction() |
||
162 | } |
||
163 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.