1 | <?php |
||
18 | class ResourceManager |
||
19 | { |
||
20 | private $mapper; |
||
21 | private $teleporter; |
||
22 | private $filesystem; |
||
23 | |||
24 | /** |
||
25 | * Constructor |
||
26 | * |
||
27 | * @param RequestMapper $mapper |
||
28 | * @param ResourceTeleporter $teleporter |
||
29 | * @param Filesystem $filesystem |
||
30 | */ |
||
31 | public function __construct(RequestMapper $mapper, ResourceTeleporter $teleporter, Filesystem $filesystem) |
||
37 | |||
38 | /** |
||
39 | * Handles an archival request. |
||
40 | * |
||
41 | * The request is an array of string|streams to compute in a context (current |
||
42 | * working directory most of the time) |
||
43 | * Some keys can be associative. In these cases, the key is used the target |
||
44 | * for the file. |
||
45 | * |
||
46 | * @param string $context |
||
47 | * @param array $request |
||
48 | * |
||
49 | * @return ResourceCollection |
||
50 | * |
||
51 | * @throws IOException In case of write failure |
||
52 | */ |
||
53 | public function handle($context, array $request) |
||
75 | |||
76 | /** |
||
77 | * This method must be called once the ResourceCollection has been processed. |
||
78 | * |
||
79 | * It will remove temporary files |
||
80 | * |
||
81 | * @todo this should be done in the __destruct method of ResourceCollection |
||
82 | * |
||
83 | * @param ResourceCollection $collection |
||
84 | */ |
||
85 | public function cleanup(ResourceCollection $collection) |
||
95 | |||
96 | /** |
||
97 | * Creates a default ResourceManager |
||
98 | * |
||
99 | * @return ResourceManager |
||
100 | */ |
||
101 | public static function create() |
||
105 | } |
||
106 |