This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace AppBundle\Controller; |
||
4 | |||
5 | use AppBundle\Controller\Infrastructure\RestController; |
||
6 | use AppBundle\Entity\Organizer; |
||
7 | use AppBundle\Form\Ambassador\OrganizerFormType; |
||
8 | use AppBundle\Form\Ambassador\OrganizerMemberFormType; |
||
9 | use Nelmio\ApiDocBundle\Annotation\ApiDoc; |
||
10 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; |
||
11 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
||
12 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; |
||
13 | use Symfony\Component\HttpFoundation\Request; |
||
14 | use Symfony\Component\HttpFoundation\Response; |
||
15 | |||
16 | /** |
||
17 | * @author Vehsamrak |
||
18 | * @Route("organizer") |
||
19 | */ |
||
20 | class OrganizerController extends RestController |
||
21 | { |
||
22 | |||
23 | /** |
||
24 | * List all registered organizers |
||
25 | * @Route("s/{limit}/{offset}", name="organizers_list") |
||
26 | * @Method("GET") |
||
27 | * @ApiDoc( |
||
28 | * section="Organizer", |
||
29 | * requirements={ |
||
30 | * { |
||
31 | * "name"="limit", |
||
32 | * "dataType"="int", |
||
33 | * "requirement"="false", |
||
34 | * "description"="limit number. Default is 50" |
||
35 | * }, |
||
36 | * { |
||
37 | * "name"="offset", |
||
38 | * "dataType"="int", |
||
39 | * "requirement"="false", |
||
40 | * "description"="offset number. Default is 0" |
||
41 | * }, |
||
42 | * }, |
||
43 | * statusCodes={ |
||
44 | * 200="OK", |
||
45 | * } |
||
46 | * ) |
||
47 | * @param int $limit Limit results. Default is 50 |
||
48 | * @param int $offset Starting serial number of result collection. Default is 0 |
||
49 | */ |
||
50 | 1 | public function listAction($limit = null, $offset = null): Response |
|
51 | { |
||
52 | 1 | return $this->listEntities($this->get('rockparade.organizer_repository'), $limit, $offset); |
|
53 | } |
||
54 | |||
55 | /** |
||
56 | * View organizer by name |
||
57 | * @Route("/{id}", name="organizer_view") |
||
58 | * @Method("GET") |
||
59 | * @ApiDoc( |
||
60 | * section="Organizer", |
||
61 | * requirements={ |
||
62 | * { |
||
63 | * "name"="id", |
||
64 | * "dataType"="string", |
||
65 | * "requirement"="true", |
||
66 | * "description"="organizer name" |
||
67 | * }, |
||
68 | * }, |
||
69 | * statusCodes={ |
||
70 | * 200="Organizer was found", |
||
71 | * 404="Organizer with given name was not found", |
||
72 | * } |
||
73 | * ) |
||
74 | * @param string $id organizer id |
||
75 | */ |
||
76 | 4 | public function viewAction(string $id): Response |
|
77 | { |
||
78 | 4 | return $this->viewEntity($this->get('rockparade.organizer_repository'), $id); |
|
79 | } |
||
80 | |||
81 | /** |
||
82 | * Create new organizer |
||
83 | * @Route("", name="organizer_create") |
||
84 | * @Method("POST") |
||
85 | * @Security("has_role('ROLE_USER')") |
||
86 | * @ApiDoc( |
||
87 | * section="Organizer", |
||
88 | * requirements={ |
||
89 | * { |
||
90 | * "name"="name", |
||
91 | * "dataType"="string", |
||
92 | * "requirement"="true", |
||
93 | * "description"="organization name" |
||
94 | * }, |
||
95 | * { |
||
96 | * "name"="description", |
||
97 | * "dataType"="string", |
||
98 | * "requirement"="true", |
||
99 | * "description"="organization description" |
||
100 | * }, |
||
101 | * { |
||
102 | * "name"="members", |
||
103 | * "dataType"="array", |
||
104 | * "requirement"="false", |
||
105 | * "description"="logins and short descriptions of organization members" |
||
106 | * }, |
||
107 | * }, |
||
108 | * statusCodes={ |
||
109 | * 201="New organizer was created. Link to new resource provided in header 'Location'", |
||
110 | * 400="Validation error", |
||
111 | * } |
||
112 | * ) |
||
113 | */ |
||
114 | 4 | View Code Duplication | public function createAction(Request $request): Response |
0 ignored issues
–
show
|
|||
115 | { |
||
116 | 4 | $form = $this->createAndProcessForm($request, OrganizerFormType::class); |
|
117 | |||
118 | 4 | $apiResponseFactory = $this->get('rockparade.api_response_factory'); |
|
119 | 4 | $response = $apiResponseFactory->createResponse( |
|
120 | 4 | $this->createApiOperation($request), |
|
121 | $form, |
||
122 | 4 | $this->getUser() |
|
123 | ); |
||
124 | |||
125 | 4 | return $this->respond($response); |
|
126 | } |
||
127 | |||
128 | /** |
||
129 | * Add new member to organization |
||
130 | * @Route("/members", name="organizer_member_create") |
||
131 | * @Method("POST") |
||
132 | * @Security("has_role('ROLE_USER')") |
||
133 | * @ApiDoc( |
||
134 | * section="Organizer", |
||
135 | * requirements={ |
||
136 | * { |
||
137 | * "name"="ambassador", |
||
138 | * "dataType"="string", |
||
139 | * "requirement"="true", |
||
140 | * "description"="organizer id" |
||
141 | * }, |
||
142 | * { |
||
143 | * "name"="login", |
||
144 | * "dataType"="string", |
||
145 | * "requirement"="true", |
||
146 | * "description"="user login" |
||
147 | * }, |
||
148 | * { |
||
149 | * "name"="short_description", |
||
150 | * "dataType"="string", |
||
151 | * "requirement"="true", |
||
152 | * "description"="short description of user role in organization" |
||
153 | * }, |
||
154 | * { |
||
155 | * "name"="description", |
||
156 | * "dataType"="string", |
||
157 | * "requirement"="false", |
||
158 | * "description"="long description of user" |
||
159 | * }, |
||
160 | * }, |
||
161 | * statusCodes={ |
||
162 | * 201="Member was added to organization", |
||
163 | * 400="Validation error", |
||
164 | * 404="Organizer or User was not found", |
||
165 | * } |
||
166 | * ) |
||
167 | */ |
||
168 | 2 | View Code Duplication | public function createMemberAction(Request $request): Response |
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
169 | { |
||
170 | 2 | $form = $this->createAndProcessForm($request, OrganizerMemberFormType::class); |
|
171 | |||
172 | 2 | $apiResponseFactory = $this->get('rockparade.api_response_factory'); |
|
173 | 2 | $response = $apiResponseFactory->createResponse( |
|
174 | 2 | $this->createApiOperation($request), |
|
175 | $form, |
||
176 | 2 | $this->getUser() |
|
177 | ); |
||
178 | |||
179 | 2 | return $this->respond($response); |
|
180 | } |
||
181 | } |
||
182 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.