1 | <?php |
||
35 | class MovieController extends BaseController |
||
36 | { |
||
37 | /** |
||
38 | * Get all movies. |
||
39 | * |
||
40 | * @Route("/api/movies", methods={"GET"}) |
||
41 | * |
||
42 | * @param Request $request |
||
43 | * @param MovieRepository $movieRepository |
||
44 | * |
||
45 | * @return \Symfony\Component\HttpFoundation\JsonResponse |
||
46 | */ |
||
47 | 17 | public function getAll(Request $request, MovieRepository $movieRepository) |
|
58 | |||
59 | /** |
||
60 | * Get movie resource. |
||
61 | * |
||
62 | * @Route("/api/movies/{id}", methods={"GET"}, requirements={"id"="\d+"}) |
||
63 | * |
||
64 | * @param int $id |
||
65 | * @param MovieRepository $repository |
||
66 | * @param ProducerInterface $producer |
||
67 | * |
||
68 | * @throws \Doctrine\ORM\NoResultException |
||
69 | * @throws \Doctrine\ORM\NonUniqueResultException |
||
70 | * |
||
71 | * @return JsonResponse |
||
72 | */ |
||
73 | 2 | public function getMovies(int $id, MovieRepository $repository, ProducerInterface $producer) |
|
87 | |||
88 | /** |
||
89 | * @Route("/api/movies/{movieId}/releaseDate/{countryCode}", methods={"GET"}, requirements={"movie"="\d+"}) |
||
90 | * @ParamConverter("country", options={"mapping": {"countryCode": "code"}}) |
||
91 | */ |
||
92 | public function getMovieReleaseDate(int $movieId, Country $country, MovieReleaseDateRepository $repository) |
||
102 | |||
103 | /** |
||
104 | * @Route("/api/movies/{id}/updatePoster", methods={"POST"}, requirements={"id"="\d+"}) |
||
105 | * |
||
106 | * @param Movie $movie |
||
107 | * @param UpdatePosterRequest $request |
||
108 | * |
||
109 | * @return JsonResponse |
||
110 | */ |
||
111 | 1 | public function postMoviesUpdatePoster(Movie $movie, UpdatePosterRequest $request) |
|
124 | |||
125 | /** |
||
126 | * Get movies by title. |
||
127 | * |
||
128 | * @Route("/api/movies/search", methods={"POST"}) |
||
129 | * |
||
130 | * @param SearchRequest $request |
||
131 | * @param SearchService $searchService |
||
132 | * @param Request $currentRequest |
||
133 | * |
||
134 | * @throws \Exception |
||
135 | * |
||
136 | * @return \Symfony\Component\HttpFoundation\JsonResponse |
||
137 | */ |
||
138 | 2 | public function getSearch(SearchRequest $request, SearchService $searchService, Request $currentRequest) |
|
150 | |||
151 | /** |
||
152 | * Create new movie. |
||
153 | * |
||
154 | * @Route("/api/movies", methods={"POST"}) |
||
155 | * |
||
156 | * @param CreateMovieRequest $request |
||
157 | * @param MovieManageService $service |
||
158 | * @param ValidatorInterface $validator |
||
159 | * |
||
160 | * @throws \Exception |
||
161 | * |
||
162 | * @return \Symfony\Component\HttpFoundation\JsonResponse |
||
163 | */ |
||
164 | 2 | public function postMovies(CreateMovieRequest $request, MovieManageService $service, ValidatorInterface $validator) |
|
183 | |||
184 | /** |
||
185 | * @Route("/api/movies/{id}", methods={"POST", "PUT", "PATCH"}, requirements={"id"="\d+"}) |
||
186 | * |
||
187 | * @param Movie $movie |
||
188 | * @param UpdateMovieRequest $request |
||
189 | * |
||
190 | * @throws \ErrorException |
||
191 | * @throws \Exception |
||
192 | * |
||
193 | * @return JsonResponse |
||
194 | */ |
||
195 | 2 | public function putMovies(Movie $movie, UpdateMovieRequest $request) |
|
228 | } |
||
229 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.