1 | <?php declare(strict_types=1); |
||
15 | final class ImportEventStore extends Command |
||
16 | { |
||
17 | /** |
||
18 | * The name and signature of the console command. |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $signature = 'smoothphp:import {--file= : If specified, import from a JSON file}'; |
||
23 | |||
24 | /** |
||
25 | * The console command description. |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $description = 'Import EventStore'; |
||
30 | |||
31 | /** @var DatabaseManager */ |
||
32 | private $databaseManager; |
||
33 | |||
34 | /** @var Repository */ |
||
35 | private $config; |
||
36 | |||
37 | /** |
||
38 | * ExportEventStore constructor. |
||
39 | * @param DatabaseManager $databaseManager |
||
40 | * @param Repository $config |
||
41 | */ |
||
42 | public function __construct(DatabaseManager $databaseManager, Repository $config) |
||
48 | |||
49 | /** |
||
50 | * Execute the console command. |
||
51 | * |
||
52 | * @return mixed |
||
53 | */ |
||
54 | public function handle() |
||
72 | |||
73 | /** |
||
74 | * Truncate (empty) event store table |
||
75 | */ |
||
76 | private function truncate() |
||
83 | |||
84 | /** |
||
85 | * Read event store JSON from std in |
||
86 | * |
||
87 | * @return string |
||
88 | */ |
||
89 | private function readFromStdIn() |
||
101 | |||
102 | /** |
||
103 | * Read event store JSON from file |
||
104 | * |
||
105 | * @return string |
||
106 | */ |
||
107 | private function readFromJsonFile() |
||
115 | } |
||
116 |