1 | <?php |
||
22 | class File implements DataSourceInterface |
||
23 | { |
||
24 | const SUMMARY_FILENAME = 'summary.json'; |
||
25 | |||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $folder; |
||
30 | |||
31 | /** |
||
32 | * @var Filesystem |
||
33 | */ |
||
34 | protected $filesystem; |
||
35 | |||
36 | /** |
||
37 | * File constructor. |
||
38 | */ |
||
39 | 112 | public function __construct($outputFolder) |
|
46 | |||
47 | /** |
||
48 | * @param $processId |
||
49 | * @return \Generator |
||
50 | * @throws \InvalidArgumentException |
||
51 | */ |
||
52 | 16 | public function getProcess($processId) |
|
68 | |||
69 | /** |
||
70 | * @throws IOException |
||
71 | * @throws \InvalidArgumentException |
||
72 | */ |
||
73 | 14 | public function clear() |
|
78 | |||
79 | /** |
||
80 | * @throws IOException |
||
81 | * @throws \InvalidArgumentException |
||
82 | */ |
||
83 | 2 | public function deleteProcess($processId) |
|
87 | |||
88 | /** |
||
89 | * @param Process $process |
||
90 | * @param array $item |
||
91 | * @throws IOException |
||
92 | * @return bool |
||
93 | */ |
||
94 | 110 | public function save(Process $process, array $item) |
|
102 | |||
103 | /** |
||
104 | * @return string |
||
105 | * @throws IOException |
||
106 | */ |
||
107 | 112 | protected function initializeFolder() |
|
113 | |||
114 | /** |
||
115 | * @param $processId |
||
116 | * @return string |
||
117 | * @throws IOException |
||
118 | */ |
||
119 | 114 | protected function getProcessFolder($processId) |
|
129 | |||
130 | /** |
||
131 | * @param int $offset |
||
132 | * @param int $limit |
||
133 | * @throws IOException |
||
134 | * @throws \InvalidArgumentException |
||
135 | * @throws \LogicException |
||
136 | * @return array |
||
137 | */ |
||
138 | 8 | public function all($offset = 0, $limit = 15) |
|
165 | |||
166 | /** |
||
167 | * @return int |
||
168 | * @throws IOException |
||
169 | * @throws \InvalidArgumentException |
||
170 | */ |
||
171 | 12 | public function count() |
|
181 | |||
182 | /** |
||
183 | * @param Process $process |
||
184 | * @param array $item |
||
185 | * @return mixed |
||
186 | * @throws IOException |
||
187 | */ |
||
188 | 6 | public function saveSummary(Process $process, array $item) |
|
204 | |||
205 | /** |
||
206 | * @return string |
||
207 | */ |
||
208 | 2 | public function getFolder() |
|
212 | } |
||
213 |