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