Conditions | 4 |
Paths | 4 |
Total Lines | 51 |
Code Lines | 31 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
41 | public function verify() |
||
42 | { |
||
43 | $IdFilter = new IdFilter( |
||
44 | $this->country, |
||
45 | $this->id_type, |
||
46 | $this->id_number, |
||
47 | $this->first_name, |
||
48 | $this->last_name, |
||
49 | $this->middle_name, |
||
50 | $this->date_of_birth, |
||
51 | $this->phone, |
||
52 | $this->pin, |
||
53 | $this->tin, |
||
54 | $this->gender, |
||
55 | $this->full_name, |
||
56 | $this->user_id, |
||
57 | $this->company, |
||
58 | $this->registration_number |
||
59 | |||
60 | ); |
||
61 | |||
62 | $response = null; |
||
63 | $pipes = [Smile::class, Appruve::class, Credequity::class,]; |
||
64 | |||
65 | $response = (new Pipeline)->send($IdFilter) |
||
66 | ->through($pipes) |
||
67 | ->then(function ($result) { |
||
68 | return $result; |
||
69 | }); |
||
70 | |||
71 | $executedHandler = strtoupper($IdFilter->getHandler()); |
||
72 | |||
73 | $validation = new Validation(); |
||
74 | |||
75 | //Validate Appruve Handler result |
||
76 | if ($executedHandler == strtoupper($this->appruveHandler)) { |
||
77 | |||
78 | return $validation->validateAppruve($response, $IdFilter); |
||
79 | } |
||
80 | |||
81 | //Validate Smile Handler result |
||
82 | if ($executedHandler == strtoupper($this->smileHandler)) { |
||
83 | return $validation->validateSmile($response, $IdFilter); |
||
84 | } |
||
85 | |||
86 | //Validate Credequity Handler result |
||
87 | if ($executedHandler == strtoupper($this->credequityHandler)) { |
||
88 | return $validation->validateCredequity($response, $IdFilter); |
||
89 | } |
||
90 | |||
91 | return $response; |
||
92 | } |
||
94 |