| Conditions | 5 | 
| Paths | 16 | 
| Total Lines | 67 | 
| Code Lines | 44 | 
| 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  | 
            ||
| 62 | 	public static function parse( SimpleXMLElement $xml ) { | 
            ||
| 63 | $message = new StatusResponseMessage();  | 
            ||
| 64 | |||
| 65 | $message->result = Security::filter( $xml['result'] );  | 
            ||
| 66 | |||
| 67 | // E-wallet  | 
            ||
| 68 | 		if ( $xml->ewallet ) { | 
            ||
| 69 | $ewallet = new stdClass();  | 
            ||
| 70 | |||
| 71 | $ewallet->id = Security::filter( $xml->ewallet->id );  | 
            ||
| 72 | $ewallet->status = Security::filter( $xml->ewallet->status );  | 
            ||
| 73 | $ewallet->created = Security::filter( $xml->ewallet->created );  | 
            ||
| 74 | $ewallet->modified = Security::filter( $xml->ewallet->modified );  | 
            ||
| 75 | $ewallet->reason_code = Security::filter( $xml->ewallet->reasoncode );  | 
            ||
| 76 | $ewallet->reason = Security::filter( $xml->ewallet->reason );  | 
            ||
| 77 | |||
| 78 | $message->ewallet = $ewallet;  | 
            ||
| 79 | }  | 
            ||
| 80 | |||
| 81 | // Customer  | 
            ||
| 82 | 		if ( $xml->customer ) { | 
            ||
| 83 | $customer = new stdClass();  | 
            ||
| 84 | |||
| 85 | $customer->currency = Security::filter( $xml->customer->currency );  | 
            ||
| 86 | $customer->amount = Security::filter( $xml->customer->amount );  | 
            ||
| 87 | $customer->exchange_rate = Security::filter( $xml->customer->exchange_rate );  | 
            ||
| 88 | $customer->first_name = Security::filter( $xml->customer->firstname );  | 
            ||
| 89 | $customer->last_name = Security::filter( $xml->customer->lastname );  | 
            ||
| 90 | $customer->last_name = Security::filter( $xml->customer->lastname );  | 
            ||
| 91 | $customer->city = Security::filter( $xml->customer->city );  | 
            ||
| 92 | $customer->state = Security::filter( $xml->customer->state );  | 
            ||
| 93 | $customer->country = Security::filter( $xml->customer->country );  | 
            ||
| 94 | |||
| 95 | $message->customer = $customer;  | 
            ||
| 96 | }  | 
            ||
| 97 | |||
| 98 | // Transaction  | 
            ||
| 99 | 		if ( $xml->transaction ) { | 
            ||
| 100 | $transaction = new stdClass();  | 
            ||
| 101 | |||
| 102 | $transaction->id = Security::filter( $xml->transaction->id );  | 
            ||
| 103 | $transaction->currency = Security::filter( $xml->transaction->currency );  | 
            ||
| 104 | $transaction->amount = Security::filter( $xml->transaction->amount );  | 
            ||
| 105 | $transaction->description = Security::filter( $xml->transaction->description );  | 
            ||
| 106 | $transaction->var1 = Security::filter( $xml->transaction->var1 );  | 
            ||
| 107 | $transaction->var2 = Security::filter( $xml->transaction->var2 );  | 
            ||
| 108 | $transaction->var3 = Security::filter( $xml->transaction->var3 );  | 
            ||
| 109 | $transaction->items = Security::filter( $xml->transaction->items );  | 
            ||
| 110 | |||
| 111 | $message->transaction = $transaction;  | 
            ||
| 112 | }  | 
            ||
| 113 | |||
| 114 | // Payment details  | 
            ||
| 115 | 		if ( $xml->paymentdetails ) { | 
            ||
| 116 | $payment_details = new stdClass();  | 
            ||
| 117 | |||
| 118 | $payment_details->type = Security::filter( $xml->paymentdetails->type );  | 
            ||
| 119 | $payment_details->account_iban = Security::filter( $xml->paymentdetails->accountiban );  | 
            ||
| 120 | $payment_details->account_bic = Security::filter( $xml->paymentdetails->accountbic );  | 
            ||
| 121 | $payment_details->account_id = Security::filter( $xml->paymentdetails->accountid );  | 
            ||
| 122 | $payment_details->account_holder_name = Security::filter( $xml->paymentdetails->accountholdername );  | 
            ||
| 123 | $payment_details->external_transaction_id = Security::filter( $xml->paymentdetails->externaltransactionid );  | 
            ||
| 124 | |||
| 125 | $message->payment_details = $payment_details;  | 
            ||
| 126 | }  | 
            ||
| 127 | |||
| 128 | return $message;  | 
            ||
| 129 | }  | 
            ||
| 131 |