1 | <?php |
||
16 | class CompaniesTableFeeder extends Command |
||
17 | { |
||
18 | |||
19 | |||
20 | /** |
||
21 | * @var DataBaseFunctions |
||
22 | */ |
||
23 | protected $db_functions; |
||
24 | |||
25 | /** |
||
26 | * @var HttpCalls |
||
27 | */ |
||
28 | protected $http_calls; |
||
29 | |||
30 | /** |
||
31 | * @var ProgressControl |
||
32 | */ |
||
33 | protected $progress_control; |
||
34 | |||
35 | /** |
||
36 | * The name and signature of the console command. |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $signature = 'companies_table:feed'; |
||
41 | |||
42 | /** |
||
43 | * The console command description. |
||
44 | * |
||
45 | * @var string |
||
46 | */ |
||
47 | protected $description = 'Feed the table companies from DB'; |
||
48 | |||
49 | /** |
||
50 | * Create a new command instance. |
||
51 | * @param DataBaseFunctions $db_functions |
||
52 | * @param HttpCalls $http_calls |
||
53 | * @param ProgressControl $progress_control |
||
54 | */ |
||
55 | public function __construct(DataBaseFunctions $db_functions,HttpCalls $http_calls,ProgressControl $progress_control) |
||
64 | |||
65 | /** |
||
66 | * Execute the console command. |
||
67 | * |
||
68 | * @return mixed |
||
69 | */ |
||
70 | public function handle() |
||
95 | } |
If the size of the collection does not change during the iteration, it is generally a good practice to compute it beforehand, and not on each iteration: