| Conditions | 5 | 
| Paths | 3 | 
| Total Lines | 51 | 
| 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  | 
            ||
| 32 | public function __invoke(InstructionFlightQuery $query)  | 
            ||
| 33 |     { | 
            ||
| 34 | $sql = 'SELECT flights.* FROM llx_bbc_vols as flights';  | 
            ||
| 35 | $sql .= ' WHERE ';  | 
            ||
| 36 | $sql .= ' flights.fk_type = 6 ';  | 
            ||
| 37 | $sql .= ' AND flights.fk_pilot = ' . $query->getStudentId();  | 
            ||
| 38 | $sql .= ' ORDER BY flights.date ';  | 
            ||
| 39 | |||
| 40 | $resql = $this->db->query($sql);  | 
            ||
| 41 | $array = [];  | 
            ||
| 42 | |||
| 43 |         if ($resql) { | 
            ||
| 44 | $num = $this->db->num_rows($resql);  | 
            ||
| 45 | $i = 0;  | 
            ||
| 46 |             if ($num) { | 
            ||
| 47 |                 while ($i < $num) { | 
            ||
| 48 | $obj = $this->db->fetch_object($resql);  | 
            ||
| 49 |                     if ($obj) { | 
            ||
| 50 | |||
| 51 | $flight = new Bbcvols($this->db);  | 
            ||
| 52 | $flight->id = $obj->idBBC_vols;  | 
            ||
| 53 | $flight->idBBC_vols = $obj->idBBC_vols;  | 
            ||
| 54 | $flight->date = $this->db->jdate($obj->date);  | 
            ||
| 55 | $flight->lieuD = $obj->lieuD;  | 
            ||
| 56 | $flight->lieuA = $obj->lieuA;  | 
            ||
| 57 | $flight->heureD = $obj->heureD;  | 
            ||
| 58 | $flight->heureA = $obj->heureA;  | 
            ||
| 59 | $flight->BBC_ballons_idBBC_ballons = $obj->BBC_ballons_idBBC_ballons;  | 
            ||
| 60 | $flight->nbrPax = $obj->nbrPax;  | 
            ||
| 61 | $flight->remarque = $obj->remarque;  | 
            ||
| 62 | $flight->incidents = $obj->incidents;  | 
            ||
| 63 | $flight->fk_type = $obj->fk_type;  | 
            ||
| 64 | $flight->fk_pilot = $obj->fk_pilot;  | 
            ||
| 65 | $flight->fk_organisateur = $obj->fk_organisateur;  | 
            ||
| 66 | $flight->is_facture = $obj->is_facture;  | 
            ||
| 67 | $flight->kilometers = $obj->kilometers;  | 
            ||
| 68 | $flight->cost = $obj->cost;  | 
            ||
| 69 | $flight->fk_receiver = $obj->fk_receiver;  | 
            ||
| 70 | $flight->justif_kilometers = $obj->justif_kilometers;  | 
            ||
| 71 | $flight->date_creation = $obj->date_creation;  | 
            ||
| 72 | $flight->date_update = $obj->date_update;  | 
            ||
| 73 | |||
| 74 | $array[] = $flight;  | 
            ||
| 75 | }  | 
            ||
| 76 | $i++;  | 
            ||
| 77 | }  | 
            ||
| 78 | }  | 
            ||
| 79 | }  | 
            ||
| 80 | |||
| 81 | return $array;  | 
            ||
| 82 | }  | 
            ||
| 83 | |||
| 84 | }  |