Conditions | 3 |
Paths | 3 |
Total Lines | 23 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 18 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
33 | 1 | public function quality() |
|
34 | { |
||
35 | $propertiesScore = [ |
||
36 | 1 | 'firstname' => 3, |
|
37 | 1 | 'lastname' => 7, |
|
38 | 1 | 'nin' => 10, |
|
39 | 1 | 'birthdate' => 5, |
|
40 | 1 | 'mobile' => 20, |
|
41 | 1 | 'email' => 15, |
|
42 | 1 | 'postal_address' => 15, |
|
43 | 1 | 'user' => 25, |
|
44 | 1 | ]; |
|
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 | 1 | } |
|
52 | 1 | } |
|
53 | |||
54 | 1 | return ceil($qualityScore / $totalScore * 100); |
|
55 | } |
||
56 | |||
82 |