1 | <?php |
||
15 | class SyncFlatten extends Command |
||
16 | { |
||
17 | use Traits\SyncTrait; |
||
18 | |||
19 | /** |
||
20 | * Number of entries to fetch per pagination. |
||
21 | * |
||
22 | * @var integer |
||
23 | */ |
||
24 | const PER_BATCH = 50; |
||
25 | |||
26 | /** |
||
27 | * {@inheritdoc} |
||
28 | */ |
||
29 | protected $signature = 'contentful:sync-flatten {--preview}'; |
||
30 | |||
31 | /** |
||
32 | * {@inheritdoc} |
||
33 | */ |
||
34 | protected $description = 'Map and persist previously synced Contentful data'; |
||
35 | |||
36 | /** |
||
37 | * Assets repository instance. |
||
38 | * |
||
39 | * @var \Distilleries\Contentful\Repositories\AssetsRepository |
||
40 | */ |
||
41 | protected $assets; |
||
42 | |||
43 | /** |
||
44 | * Entries repository instance. |
||
45 | * |
||
46 | * @var \Distilleries\Contentful\Repositories\EntriesRepository |
||
47 | */ |
||
48 | protected $entries; |
||
49 | |||
50 | /** |
||
51 | * MapEntries command constructor. |
||
52 | * |
||
53 | * @return void |
||
|
|||
54 | */ |
||
55 | public function __construct() |
||
63 | |||
64 | /** |
||
65 | * Execute the console command. |
||
66 | * |
||
67 | * @return void |
||
68 | */ |
||
69 | public function handle() |
||
96 | |||
97 | /** |
||
98 | * Map and persist synced data. |
||
99 | * |
||
100 | * @return void |
||
101 | * @throws \Exception |
||
102 | */ |
||
103 | private function flattenSyncedData() |
||
124 | |||
125 | /** |
||
126 | * Create custom progress bar. |
||
127 | * |
||
128 | * @param integer $total |
||
129 | * @return \Symfony\Component\Console\Helper\ProgressBar |
||
130 | */ |
||
131 | private function createProgressBar(int $total): ProgressBar |
||
139 | |||
140 | /** |
||
141 | * Map and persist given sync_entries item. |
||
142 | * |
||
143 | * @param \stdClass $item |
||
144 | * @param \Illuminate\Support\Collection $locales |
||
145 | * @return void |
||
146 | * @throws \Exception |
||
147 | */ |
||
148 | private function mapItemToContentfulModel(stdClass $item, Collection $locales) |
||
158 | } |
||
159 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.