Total Complexity | 6 |
Total Lines | 80 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | class Name extends BaseModel |
||
6 | { |
||
7 | protected $gender; |
||
8 | |||
9 | protected $name; |
||
10 | |||
11 | protected $probability; |
||
12 | |||
13 | protected $count; |
||
14 | |||
15 | /** |
||
16 | * Create new instance of Name model |
||
17 | */ |
||
18 | public function __construct($data) |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * Merge data with default so every field is available |
||
30 | * |
||
31 | * @return object |
||
32 | */ |
||
33 | protected function prepareData($data) |
||
34 | { |
||
35 | $default = new \StdClass; |
||
36 | $default->name = null; |
||
37 | $default->gender = null; |
||
38 | $default->probability = null; |
||
39 | $default->count = null; |
||
40 | |||
41 | return (object) array_merge( |
||
42 | (array) $default, |
||
43 | (array) $data |
||
44 | ); |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Check if name is male |
||
49 | * |
||
50 | * @return bool |
||
51 | */ |
||
52 | public function isMale() |
||
53 | { |
||
54 | return $this->gender === 'male'; |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * Check if name is not male |
||
59 | * |
||
60 | * @return bool |
||
61 | */ |
||
62 | public function isNotMale() |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * Check if name is female |
||
69 | * |
||
70 | * @return bool |
||
71 | */ |
||
72 | public function isFemale() |
||
73 | { |
||
74 | return $this->gender === 'female'; |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * Check if name is not female |
||
79 | * |
||
80 | * @return bool |
||
81 | */ |
||
82 | public function isNotFemale() |
||
85 | } |
||
86 | } |
||
87 |