1 | <?php |
||
16 | class SyncFlatten extends Command |
||
17 | { |
||
18 | use Traits\SyncTrait; |
||
19 | |||
20 | /** |
||
21 | * Number of entries to fetch per pagination. |
||
22 | * |
||
23 | * @var integer |
||
24 | */ |
||
25 | const PER_BATCH = 50; |
||
26 | |||
27 | /** |
||
28 | * {@inheritdoc} |
||
29 | */ |
||
30 | protected $signature = 'contentful:sync-flatten {--preview} {--no-switch} {--truncate} {--multi}'; |
||
31 | |||
32 | /** |
||
33 | * {@inheritdoc} |
||
34 | */ |
||
35 | protected $description = 'Map and persist previously synced Contentful data'; |
||
36 | |||
37 | /** |
||
38 | * Assets repository instance. |
||
39 | * |
||
40 | * @var \Distilleries\Contentful\Repositories\AssetsRepository |
||
41 | */ |
||
42 | protected $assets; |
||
43 | |||
44 | /** |
||
45 | * Entries repository instance. |
||
46 | * |
||
47 | * @var \Distilleries\Contentful\Repositories\EntriesRepository |
||
48 | */ |
||
49 | protected $entries; |
||
50 | |||
51 | /** |
||
52 | * MapEntries command constructor. |
||
53 | * |
||
54 | * @return void |
||
|
|||
55 | */ |
||
56 | public function __construct() |
||
64 | |||
65 | protected function canSwitch(): bool |
||
70 | |||
71 | protected function withTruncate(): bool |
||
76 | |||
77 | protected function isPreview(): bool |
||
82 | |||
83 | protected function isMultiThread(): bool |
||
88 | |||
89 | /** |
||
90 | * Execute the console command. |
||
91 | * |
||
92 | * @return void |
||
93 | */ |
||
94 | public function handle(Release $release) |
||
134 | |||
135 | /** |
||
136 | * Map and persist synced data. |
||
137 | * |
||
138 | * @return void |
||
139 | * @throws \Exception |
||
140 | */ |
||
141 | protected function flattenSyncedData() |
||
162 | |||
163 | protected function flattenSyncedDataMultiThread(Release $release) |
||
198 | |||
199 | /** |
||
200 | * Update progress from other threads. |
||
201 | * |
||
202 | * @return void |
||
203 | */ |
||
204 | protected function updateFromOtherThread($bar) |
||
208 | |||
209 | /** |
||
210 | * Get current release. |
||
211 | * |
||
212 | */ |
||
213 | protected function getCurrentRelease(Release $release) |
||
217 | |||
218 | /** |
||
219 | * Create custom progress bar. |
||
220 | * |
||
221 | * @param integer $total |
||
222 | * @return \Symfony\Component\Console\Helper\ProgressBar |
||
223 | */ |
||
224 | protected function createProgressBar(int $total): ProgressBar |
||
232 | |||
233 | /** |
||
234 | * Map and persist given sync_entries item. |
||
235 | * |
||
236 | * @param \stdClass $item |
||
237 | * @param \Illuminate\Support\Collection $locales |
||
238 | * @return void |
||
239 | * @throws \Exception |
||
240 | */ |
||
241 | protected function mapItemToContentfulModel(stdClass $item, Collection $locales) |
||
251 | } |
||
252 |
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.