Passed
Push — master ( 13c68b...f8775d )
by Nícollas
01:46
created

User::userData()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 19
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 14
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 19
rs 9.7998
1
<?php
2
3
namespace App\Models;
4
5
class User
6
{
7
    public static $names = [
8
        1 => 'Nicollas',
9
        'John',
10
        'Leo',
11
        'Tiago',
12
        'Hey, I\'m bug... You friend!'
13
    ];
14
15
    public static function find(Int $id)
16
    {
17
        return self::userData($id);
18
    }
19
20
    public static function userData(Int $id)
21
    {
22
        if(!isset(self::$names[$id])) {
23
            return [
24
                'error' => 404,
25
                'message' => 'User not found'
26
            ];
27
        }
28
29
        return [
30
            'id' => $id,
31
            'name' => self::$names[$id],
32
            'email' => '[email protected]',
33
            'developer' => true,
34
            'age' => 21,
35
            'from' => 'Brazil',
36
            'inspire' => [
37
                'I need a six month holiday, TWICE A YEAR!',
38
                'Men also have feelings... For example, they can feel hungry.'
39
            ]
40
        ];
41
    }
42
}
43