ActorMovieController   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 5
dl 0
loc 25
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getActorsMovies() 0 11 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