Conditions | 3 |
Paths | 3 |
Total Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
33 | 1 | public function quality() |
|
34 | { |
||
35 | $propertiesScore = [ |
||
36 | 1 | 'firstname' => 3, |
|
37 | 'lastname' => 7, |
||
38 | 'nin' => 10, |
||
39 | 'birthdate' => 5, |
||
40 | 'mobile' => 20, |
||
41 | 'email' => 15, |
||
42 | 'postal_address' => 15, |
||
43 | 'user' => 25, |
||
44 | ]; |
||
45 | 1 | $totalScore = array_sum($propertiesScore); |
|
46 | |||
47 | 1 | $qualityScore = 0; |
|
48 | 1 | foreach ($propertiesScore as $property => $score) { |
|
49 | 1 | if (trim($this->wrappedObject->$property) !== '') { |
|
50 | 1 | $qualityScore += $score; |
|
51 | } |
||
52 | } |
||
53 | |||
54 | 1 | return ceil($qualityScore / $totalScore * 100); |
|
55 | } |
||
56 | |||
82 |