| Conditions | 10 |
| Paths | 162 |
| Total Lines | 59 |
| Code Lines | 27 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 23 | public function getData( ) |
||
| 24 | { |
||
| 25 | $this->validate( 'checkoutId', 'amount', 'currency', 'description', 'transactionId' ); |
||
| 26 | |||
| 27 | $return = [ |
||
| 28 | 'ik_co_id' => $this->getCheckoutId( ), |
||
| 29 | 'ik_am' => $this->getAmount( ), |
||
| 30 | 'ik_pm_no' => $this->getTransactionId( ), |
||
| 31 | 'ik_desc' => $this->getDescription( ), |
||
| 32 | 'ik_cur' => $this->getCurrency( ), |
||
| 33 | ]; |
||
| 34 | |||
| 35 | if( $ik_pnd_u = $this->getReturnUrl( ) ) |
||
| 36 | { |
||
| 37 | $return[ 'ik_pnd_u' ] = $ik_pnd_u; |
||
| 38 | |||
| 39 | if( $ik_pnd_m = $this->getReturnMethod( ) ) |
||
| 40 | { |
||
| 41 | $return[ 'ik_pnd_m' ] = $ik_pnd_m; |
||
| 42 | } |
||
| 43 | } |
||
| 44 | |||
| 45 | if( $ik_suc_u = $this->getReturnUrl( ) ) |
||
| 46 | { |
||
| 47 | $return[ 'ik_suc_u' ] = $ik_suc_u; |
||
| 48 | |||
| 49 | if( $ik_suc_m = $this->getReturnMethod( ) ) |
||
| 50 | { |
||
| 51 | $return[ 'ik_suc_m' ] = $ik_suc_m; |
||
| 52 | } |
||
| 53 | } |
||
| 54 | |||
| 55 | if( $ik_fal_u = $this->getCancelUrl( ) ) |
||
| 56 | { |
||
| 57 | $return[ 'ik_fal_u' ] = $ik_fal_u; |
||
| 58 | |||
| 59 | if( $ik_fal_m = $this->getCancelMethod( ) ) |
||
| 60 | { |
||
| 61 | $return[ 'ik_fal_m' ] = $ik_fal_m; |
||
| 62 | } |
||
| 63 | } |
||
| 64 | |||
| 65 | if( $ik_ia_u = $this->getNotifyUrl( ) ) |
||
| 66 | { |
||
| 67 | $return[ 'ik_ia_u' ] = $ik_ia_u; |
||
| 68 | |||
| 69 | if( $ik_ia_m = $this->getNotifyMethod( ) ) |
||
| 70 | { |
||
| 71 | $return[ 'ik_ia_m' ] = $ik_ia_m; |
||
| 72 | } |
||
| 73 | } |
||
| 74 | |||
| 75 | if( $signKey = $this->getSignKey( ) ) |
||
| 76 | { |
||
| 77 | $return[ 'ik_sign' ] = $this->calculateSign( $return, $signKey ); |
||
| 78 | } |
||
| 79 | |||
| 80 | return $return; |
||
| 81 | } |
||
| 82 | |||
| 92 | } |