1 | <?php |
||
28 | class Checkpoint { |
||
29 | |||
30 | const CORE_DIR = 'core'; |
||
31 | const APP_DIR = 'apps'; |
||
32 | |||
33 | /** |
||
34 | * @var Locator $locator |
||
35 | */ |
||
36 | protected $locator; |
||
37 | |||
38 | /** |
||
39 | * @var Filesystemhelper $fsHelper |
||
40 | */ |
||
41 | protected $fsHelper; |
||
42 | |||
43 | /** |
||
44 | * |
||
45 | * @param Locator $locator |
||
46 | * @param FilesystemHelper $fsHelper |
||
47 | */ |
||
48 | 2 | public function __construct(Locator $locator, FilesystemHelper $fsHelper){ |
|
52 | |||
53 | /** |
||
54 | * Creates a checkpoint |
||
55 | * @return string |
||
56 | * @throws Exception if base checkpoint directory is not writable |
||
57 | */ |
||
58 | public function create(){ |
||
98 | |||
99 | /** |
||
100 | * Restore a checkpoint by id |
||
101 | * @param string $checkpointId id of checkpoint |
||
102 | * @return array |
||
103 | * @throws UnexpectedValueException if there is no checkpoint with this id |
||
104 | */ |
||
105 | public function restore($checkpointId){ |
||
112 | |||
113 | /** |
||
114 | * Remove a checkpoint by id |
||
115 | * @param string $checkpointId id of checkpoint |
||
116 | * @return array |
||
117 | * @throws UnexpectedValueException if there is no checkpoint with this id |
||
118 | */ |
||
119 | public function remove($checkpointId){ |
||
124 | |||
125 | /** |
||
126 | * Return all checkpoints as an array of items [ 'title', 'date' ] |
||
127 | * @return array |
||
128 | */ |
||
129 | 2 | public function getAll(){ |
|
144 | |||
145 | /** |
||
146 | * Check if there is a checkpoint with a given id |
||
147 | * @param string $checkpointId id of checkpoint |
||
148 | * @return bool |
||
149 | */ |
||
150 | public function checkpointExists($checkpointId){ |
||
153 | |||
154 | /** |
||
155 | * Return array of all checkpoint ids |
||
156 | * @return array |
||
157 | */ |
||
158 | 2 | protected function getAllCheckpointIds(){ |
|
170 | |||
171 | /** |
||
172 | * Create an unique checkpoint id |
||
173 | * @return string |
||
174 | */ |
||
175 | protected function createCheckpointId(){ |
||
179 | |||
180 | /** |
||
181 | * Get an absolute path to the checkpoint directory by checkpoint Id |
||
182 | * @param string $checkpointId id of checkpoint |
||
183 | * @return string |
||
184 | */ |
||
185 | 1 | protected function getCheckpointPath($checkpointId){ |
|
188 | |||
189 | /** |
||
190 | * Produce an error on non-existing checkpoints |
||
191 | * @param string $checkpointId id of checkpoint |
||
192 | * @throws UnexpectedValueException if there is no checkpoint with this id |
||
193 | */ |
||
194 | private function assertCheckpointExists($checkpointId){ |
||
200 | } |
||
201 |