| Conditions | 10 | 
| Paths | 72 | 
| Total Lines | 56 | 
| Code Lines | 25 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 5 | ||
| Bugs | 1 | 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  | 
            ||
| 46 | public function getList($options)  | 
            ||
| 47 |     { | 
            ||
| 48 | $sqlWhere = 'status = \''.self::STATUS_FINISHED.'\'';  | 
            ||
| 49 | |||
| 50 | /*  | 
            ||
| 51 | * We define the Date filters.  | 
            ||
| 52 | */  | 
            ||
| 53 |         if (isset($options['date'])) { | 
            ||
| 54 |             if (!empty($options['date']['start'])) { | 
            ||
| 55 |                 $endDate = new \DateTime("tomorrow"); | 
            ||
| 56 |                 if (!empty($options['date']['end'])) { | 
            ||
| 57 | $endDate = $options['date']['end'];  | 
            ||
| 58 | }  | 
            ||
| 59 |                 $sqlWhereDate = 'send_date between \''.$options['date']['start']->format("Y-m-d").'\' and \''.$endDate->format("Y-m-d").'\''; | 
            ||
| 60 |             } elseif (!empty($options['date']['end'])) { | 
            ||
| 61 |                 $sqlWhereDate = 'send_date <= \''.$options['date']['end']->format("Y-m-d").'\''; | 
            ||
| 62 | }  | 
            ||
| 63 | |||
| 64 |             if (isset($sqlWhereDate)) { | 
            ||
| 65 | $sqlWhere.= ' and '.$sqlWhereDate;  | 
            ||
| 66 | }  | 
            ||
| 67 | }  | 
            ||
| 68 | |||
| 69 | /*  | 
            ||
| 70 | * We define the List filters.  | 
            ||
| 71 | */  | 
            ||
| 72 |         if (isset($options['list']) && preg_match("`([A-z0-9 _-]+)`", $options['list'])) { | 
            ||
| 73 | // We clean the string  | 
            ||
| 74 | $options['list'] = trim($options['list']);  | 
            ||
| 75 | |||
| 76 | $sqlWhereList = 'user_list = \''.$options['list'].'\'';  | 
            ||
| 77 | |||
| 78 | $sqlWhere.= ' and '.$sqlWhereList;  | 
            ||
| 79 | }  | 
            ||
| 80 | |||
| 81 | /*  | 
            ||
| 82 | * We define the fields.  | 
            ||
| 83 | */  | 
            ||
| 84 | $fields = self::DEFAULT_FIELDS;  | 
            ||
| 85 |         if (isset($options['fields'])) { | 
            ||
| 86 | $fields = $options['fields'];  | 
            ||
| 87 | }  | 
            ||
| 88 | |||
| 89 | /*  | 
            ||
| 90 | * Override the limit.  | 
            ||
| 91 | */  | 
            ||
| 92 | $limit = self::DEFAULT_LIMIT;  | 
            ||
| 93 |         if (isset($options['limit'])) { | 
            ||
| 94 | $limit = $options['limit'];  | 
            ||
| 95 | }  | 
            ||
| 96 | |||
| 97 | return $this->client->webservice(  | 
            ||
| 98 | 'dsCampaignGetAll',  | 
            ||
| 99 | array($sqlWhere, $fields, $this->withStatistics, $limit)  | 
            ||
| 100 | );  | 
            ||
| 101 | }  | 
            ||
| 102 | |||
| 129 |