ActorMovieController::getActorsMovies()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 6
cts 6
cp 1
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 1
1
<?php
2
3
namespace App\Actors\Controller;
4
5
use App\Controller\BaseController;
6
use App\Movies\Repository\MovieRepository;
7
use App\Movies\Transformer\MovieTransformer;
8
use App\Pagination\CustomPaginatedCollection;
9
use Symfony\Component\HttpFoundation\JsonResponse;
10
use Symfony\Component\HttpFoundation\Request;
11
use Symfony\Component\Routing\Annotation\Route;
12
13
class ActorMovieController extends BaseController
14
{
15
    /**
16
     * @Route("/api/actors/{id}/movies", methods={"GET"}, requirements={"id"="\d+"})
17
     *
18
     * @param Request         $request
19
     * @param int             $id
20
     * @param MovieRepository $repository
21
     *
22
     * @throws
23
     *
24
     * @return JsonResponse
25
     */
26 2
    public function getActorsMovies(Request $request, int $id, MovieRepository $repository)
27
    {
28 2
        [$movies, $ids, $count] = $repository->findAllByActor($id, $this->getUser());
0 ignored issues
show
Bug introduced by
The variable $movies does not exist. Did you forget to declare it?

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.

Loading history...
Bug introduced by
The variable $ids does not exist. Did you forget to declare it?

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.

Loading history...
Bug introduced by
The variable $count does not exist. Did you forget to declare it?

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.

Loading history...
29
30 2
        $offset = (int) $request->get('offset', 0);
31 2
        $limit = $request->get('limit', null);
32
33 2
        $collection = new CustomPaginatedCollection($movies, $ids, $count, $offset, $limit);
34
35 2
        return $this->items($collection, MovieTransformer::list());
36
    }
37
}
38