| Conditions | 8 | 
| Paths | 128 | 
| Total Lines | 54 | 
| Code Lines | 27 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| 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  | 
            ||
| 78 | public function __construct(PayListVirtualCardsOptions $params)  | 
            ||
| 79 |     { | 
            ||
| 80 |         if ($params->SubType !== null) { | 
            ||
| 81 | $this->SubType = $params->SubType;  | 
            ||
| 82 | }  | 
            ||
| 83 | |||
| 84 |         if ($params->VendorCode !== null) { | 
            ||
| 85 | $this->VendorCode = $params->VendorCode;  | 
            ||
| 86 | }  | 
            ||
| 87 | |||
| 88 |         if ($params->AmountRange !== null) { | 
            ||
| 89 | $this->AmountRange = new AmountRange($params);  | 
            ||
| 90 | }  | 
            ||
| 91 | |||
| 92 |         if ($params->CurrencyCode !== null) { | 
            ||
| 93 | $this->CurrencyCode = $params->CurrencyCode;  | 
            ||
| 94 | }  | 
            ||
| 95 | |||
| 96 | $period = $params->Period;  | 
            ||
| 97 | |||
| 98 |         if ($period !== null) { | 
            ||
| 99 | /**  | 
            ||
| 100 | * For unknown reason, the SOAP client does not generate proper XML with attributes for Period node.  | 
            ||
| 101 | * Expected to have <Period Start="2017-04-01" End="2017-04-1" EventType="Creation" />  | 
            ||
| 102 | * But generated XML never contains "Start" and "End" attributes (by the way "EventType" present).  | 
            ||
| 103 | * This SoapVar solution is not ideal, but at least it works.  | 
            ||
| 104 | */  | 
            ||
| 105 | $periodAttributes = array_filter([  | 
            ||
| 106 |                 'Start' => $period->start?->format('Y-m-d'), | 
            ||
| 107 |                 'End' => $period->end?->format('Y-m-d'), | 
            ||
| 108 | 'EventType' => $period->eventType,  | 
            ||
| 109 | ]);  | 
            ||
| 110 | |||
| 111 | // Result is <ns1:Period Start="2017-04-01" End="2017-04-1" EventType="Creation" />  | 
            ||
| 112 | $xml = sprintf(  | 
            ||
| 113 | '<ns1:Period %s ></ns1:Period>',  | 
            ||
| 114 | implode(  | 
            ||
| 115 | ' ',  | 
            ||
| 116 | array_map(  | 
            ||
| 117 |                         static fn (string $key, string $value): string => sprintf('%s="%s"', $key, $value), | 
            ||
| 118 | array_keys($periodAttributes),  | 
            ||
| 119 | $periodAttributes,  | 
            ||
| 120 | ),  | 
            ||
| 121 | ),  | 
            ||
| 122 | );  | 
            ||
| 123 | $this->Period = new \SoapVar($xml, XSD_ANYXML);  | 
            ||
| 124 | }  | 
            ||
| 125 | |||
| 126 |         if ($params->CardStatus !== null) { | 
            ||
| 127 | $this->CardStatus = $params->CardStatus;  | 
            ||
| 128 | }  | 
            ||
| 129 | |||
| 130 |         if ($params->Reservation !== null) { | 
            ||
| 131 | $this->Reservation = new Reservation($params);  | 
            ||
| 132 | }  | 
            ||
| 135 |