Person   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 5
Bugs 0 Features 2
Metric Value
wmc 3
c 5
b 0
f 2
lcom 1
cbo 2
dl 0
loc 53
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 10 1
A spareChange() 0 8 2
1
<?php
2
3
4
namespace App\Lib\DsManager\Models\Common;
5
6
7
use App\Lib\DsManager\Helpers\Randomizer;
8
9
abstract class Person extends DsManagerModel
10
{
11
	/**
12
	 * @var
13
	 */
14
	public $name;
15
	/**
16
	 * @var
17
	 */
18
	public $surname;
19
	/**
20
	 * @var
21
	 */
22
	public $nationality;
23
	/**
24
	 * @var
25
	 */
26
	public $age;
27
	/**
28
	 * @var
29
	 */
30
	public $skillAvg;
31
	/**
32
	 * @var
33
	 */
34
	public $wageReq;
35
36
	/**
37
	 * @return array
38
	 */
39
	public function toArray()
40
	{
41
		$result = [];
42
		$result['name'] = $this->name;
43
		$result['surname'] = $this->surname;
44
		$result['nationality'] = $this->nationality;
45
		$result['age'] = $this->age;
46
		$result['skillAvg'] = $this->skillAvg;
47
		return $result;
48
	}
49
50
	/**
51
	 * @return float|int
52
	 */
53
	protected function spareChange()
54
	{
55
		if (Randomizer::boolOnPercentage(50)) {
56
			return (rand(1, 5) / 10.0);
57
		} else {
58
			return (-1) * (rand(1, 5) / 10.0);
59
		}
60
	}
61
}