ApiController   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 6
Bugs 1 Features 5
Metric Value
wmc 4
c 6
b 1
f 5
lcom 0
cbo 3
dl 0
loc 45
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A categories() 0 15 2
A actors() 0 17 2
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use App\Http\Models\Actors;
6
use App\Http\Models\Categories;
7
8
/**
9
 * Class ApiController.
10
 */
11
class ApiController extends Controller
12
{
13
14
    /**
15
     * Me retournera mes données de catégorie.
16
     */
17
    public function categories()
18
    {
19
        $tab = [];
20
        $categories = Categories::all();
21
22
        foreach ($categories as $categorie) {
23
            $tab[] =
24
                [
25
                    $categorie->title,
26
                    count($categorie->movies),
27
                ];
28
        }
29
30
        return $tab;
31
    }
32
33
    /**
34
     * Get Actors.
35
     *
36
     * @return array
37
     */
38
    public function actors()
39
    {
40
        $obj = new Actors();
41
        $resultat = $obj->getNbActorsByCity();
42
43
        //exit(dump($resultat));
0 ignored issues
show
Unused Code Comprehensibility introduced by
88% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
44
45
        $tab = [];
46
        foreach ($resultat as $actor) {
47
            $tab[] = [
48
                'name' => $actor->city,
49
                'data' => [(int) $actor->nb],
50
            ];
51
        }
52
53
        return $tab;
54
    }
55
}
56