| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 51 | 
| Code Lines | 43 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 1 | 
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  | 
            ||
| 13 | public function run()  | 
            ||
| 14 |     { | 
            ||
| 15 |         \DB::table('purchases')->delete(); | 
            ||
| 16 | |||
| 17 |         \DB::table('purchases')->insert(array ( | 
            ||
| 18 | 0 =>  | 
            ||
| 19 | array (  | 
            ||
| 20 | 'id' => 1,  | 
            ||
| 21 | 'supplier_id' => 1,  | 
            ||
| 22 | 'make_id' => 2,  | 
            ||
| 23 | 'quantity' => 10,  | 
            ||
| 24 | 'price' => 10000.0,  | 
            ||
| 25 | 'date_purchased' => '2016-03-01',  | 
            ||
| 26 | 'delivery_date' => '2016-04-01',  | 
            ||
| 27 | 'deleted_at' => NULL,  | 
            ||
| 28 | ),  | 
            ||
| 29 | 2 =>  | 
            ||
| 30 | array (  | 
            ||
| 31 | 'id' => 3,  | 
            ||
| 32 | 'supplier_id' => 1,  | 
            ||
| 33 | 'make_id' => 2,  | 
            ||
| 34 | 'quantity' => 10,  | 
            ||
| 35 | 'price' => 10000.0,  | 
            ||
| 36 | 'date_purchased' => '2016-03-01',  | 
            ||
| 37 | 'delivery_date' => '2016-04-01',  | 
            ||
| 38 | 'deleted_at' => NULL,  | 
            ||
| 39 | ),  | 
            ||
| 40 | 3 =>  | 
            ||
| 41 | array (  | 
            ||
| 42 | 'id' => 4,  | 
            ||
| 43 | 'supplier_id' => 1,  | 
            ||
| 44 | 'make_id' => 1,  | 
            ||
| 45 | 'quantity' => 50,  | 
            ||
| 46 | 'price' => 100000.0,  | 
            ||
| 47 | 'date_purchased' => '2016-03-05',  | 
            ||
| 48 | 'delivery_date' => '2016-04-05',  | 
            ||
| 49 | 'deleted_at' => NULL,  | 
            ||
| 50 | ),  | 
            ||
| 51 | 4 =>  | 
            ||
| 52 | array (  | 
            ||
| 53 | 'id' => 5,  | 
            ||
| 54 | 'supplier_id' => 1,  | 
            ||
| 55 | 'make_id' => 2,  | 
            ||
| 56 | 'quantity' => 500,  | 
            ||
| 57 | 'price' => 450000.0,  | 
            ||
| 58 | 'date_purchased' => '2016-04-18',  | 
            ||
| 59 | 'delivery_date' => '2016-05-31',  | 
            ||
| 60 | 'deleted_at' => NULL,  | 
            ||
| 61 | ),  | 
            ||
| 62 | ));  | 
            ||
| 63 | }  | 
            ||
| 64 | }  | 
            ||
| 65 | 
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.