@@ -30,46 +30,46 @@ |
||
30 | 30 | |
31 | 31 | class UploadFile implements IFile { |
32 | 32 | |
33 | - /** @var File */ |
|
34 | - private $file; |
|
33 | + /** @var File */ |
|
34 | + private $file; |
|
35 | 35 | |
36 | - public function __construct(File $file) { |
|
37 | - $this->file = $file; |
|
38 | - } |
|
36 | + public function __construct(File $file) { |
|
37 | + $this->file = $file; |
|
38 | + } |
|
39 | 39 | |
40 | - public function put($data) { |
|
41 | - return $this->file->put($data); |
|
42 | - } |
|
40 | + public function put($data) { |
|
41 | + return $this->file->put($data); |
|
42 | + } |
|
43 | 43 | |
44 | - public function get() { |
|
45 | - return $this->file->get(); |
|
46 | - } |
|
44 | + public function get() { |
|
45 | + return $this->file->get(); |
|
46 | + } |
|
47 | 47 | |
48 | - public function getContentType() { |
|
49 | - return $this->file->getContentType(); |
|
50 | - } |
|
48 | + public function getContentType() { |
|
49 | + return $this->file->getContentType(); |
|
50 | + } |
|
51 | 51 | |
52 | - public function getETag() { |
|
53 | - return $this->file->getETag(); |
|
54 | - } |
|
52 | + public function getETag() { |
|
53 | + return $this->file->getETag(); |
|
54 | + } |
|
55 | 55 | |
56 | - public function getSize() { |
|
57 | - return $this->file->getSize(); |
|
58 | - } |
|
56 | + public function getSize() { |
|
57 | + return $this->file->getSize(); |
|
58 | + } |
|
59 | 59 | |
60 | - public function delete() { |
|
61 | - $this->file->delete(); |
|
62 | - } |
|
60 | + public function delete() { |
|
61 | + $this->file->delete(); |
|
62 | + } |
|
63 | 63 | |
64 | - public function getName() { |
|
65 | - return $this->file->getName(); |
|
66 | - } |
|
64 | + public function getName() { |
|
65 | + return $this->file->getName(); |
|
66 | + } |
|
67 | 67 | |
68 | - public function setName($name) { |
|
69 | - $this->file->setName($name); |
|
70 | - } |
|
68 | + public function setName($name) { |
|
69 | + $this->file->setName($name); |
|
70 | + } |
|
71 | 71 | |
72 | - public function getLastModified() { |
|
73 | - return $this->file->getLastModified(); |
|
74 | - } |
|
72 | + public function getLastModified() { |
|
73 | + return $this->file->getLastModified(); |
|
74 | + } |
|
75 | 75 | } |
@@ -30,68 +30,68 @@ |
||
30 | 30 | |
31 | 31 | class UploadFolder implements ICollection { |
32 | 32 | |
33 | - /** @var Directory */ |
|
34 | - private $node; |
|
35 | - /** @var CleanupService */ |
|
36 | - private $cleanupService; |
|
37 | - |
|
38 | - public function __construct(Directory $node, CleanupService $cleanupService) { |
|
39 | - $this->node = $node; |
|
40 | - $this->cleanupService = $cleanupService; |
|
41 | - } |
|
42 | - |
|
43 | - public function createFile($name, $data = null) { |
|
44 | - // TODO: verify name - should be a simple number |
|
45 | - $this->node->createFile($name, $data); |
|
46 | - } |
|
47 | - |
|
48 | - public function createDirectory($name) { |
|
49 | - throw new Forbidden('Permission denied to create file (filename ' . $name . ')'); |
|
50 | - } |
|
51 | - |
|
52 | - public function getChild($name) { |
|
53 | - if ($name === '.file') { |
|
54 | - return new FutureFile($this->node, '.file'); |
|
55 | - } |
|
56 | - return new UploadFile($this->node->getChild($name)); |
|
57 | - } |
|
58 | - |
|
59 | - public function getChildren() { |
|
60 | - $tmpChildren = $this->node->getChildren(); |
|
61 | - |
|
62 | - $children = []; |
|
63 | - $children[] = new FutureFile($this->node, '.file'); |
|
64 | - |
|
65 | - foreach ($tmpChildren as $child) { |
|
66 | - $children[] = new UploadFile($child); |
|
67 | - } |
|
68 | - |
|
69 | - return $children; |
|
70 | - } |
|
71 | - |
|
72 | - public function childExists($name) { |
|
73 | - if ($name === '.file') { |
|
74 | - return true; |
|
75 | - } |
|
76 | - return $this->node->childExists($name); |
|
77 | - } |
|
78 | - |
|
79 | - public function delete() { |
|
80 | - $this->node->delete(); |
|
81 | - |
|
82 | - // Background cleanup job is not needed anymore |
|
83 | - $this->cleanupService->removeJob($this->getName()); |
|
84 | - } |
|
85 | - |
|
86 | - public function getName() { |
|
87 | - return $this->node->getName(); |
|
88 | - } |
|
89 | - |
|
90 | - public function setName($name) { |
|
91 | - throw new Forbidden('Permission denied to rename this folder'); |
|
92 | - } |
|
93 | - |
|
94 | - public function getLastModified() { |
|
95 | - return $this->node->getLastModified(); |
|
96 | - } |
|
33 | + /** @var Directory */ |
|
34 | + private $node; |
|
35 | + /** @var CleanupService */ |
|
36 | + private $cleanupService; |
|
37 | + |
|
38 | + public function __construct(Directory $node, CleanupService $cleanupService) { |
|
39 | + $this->node = $node; |
|
40 | + $this->cleanupService = $cleanupService; |
|
41 | + } |
|
42 | + |
|
43 | + public function createFile($name, $data = null) { |
|
44 | + // TODO: verify name - should be a simple number |
|
45 | + $this->node->createFile($name, $data); |
|
46 | + } |
|
47 | + |
|
48 | + public function createDirectory($name) { |
|
49 | + throw new Forbidden('Permission denied to create file (filename ' . $name . ')'); |
|
50 | + } |
|
51 | + |
|
52 | + public function getChild($name) { |
|
53 | + if ($name === '.file') { |
|
54 | + return new FutureFile($this->node, '.file'); |
|
55 | + } |
|
56 | + return new UploadFile($this->node->getChild($name)); |
|
57 | + } |
|
58 | + |
|
59 | + public function getChildren() { |
|
60 | + $tmpChildren = $this->node->getChildren(); |
|
61 | + |
|
62 | + $children = []; |
|
63 | + $children[] = new FutureFile($this->node, '.file'); |
|
64 | + |
|
65 | + foreach ($tmpChildren as $child) { |
|
66 | + $children[] = new UploadFile($child); |
|
67 | + } |
|
68 | + |
|
69 | + return $children; |
|
70 | + } |
|
71 | + |
|
72 | + public function childExists($name) { |
|
73 | + if ($name === '.file') { |
|
74 | + return true; |
|
75 | + } |
|
76 | + return $this->node->childExists($name); |
|
77 | + } |
|
78 | + |
|
79 | + public function delete() { |
|
80 | + $this->node->delete(); |
|
81 | + |
|
82 | + // Background cleanup job is not needed anymore |
|
83 | + $this->cleanupService->removeJob($this->getName()); |
|
84 | + } |
|
85 | + |
|
86 | + public function getName() { |
|
87 | + return $this->node->getName(); |
|
88 | + } |
|
89 | + |
|
90 | + public function setName($name) { |
|
91 | + throw new Forbidden('Permission denied to rename this folder'); |
|
92 | + } |
|
93 | + |
|
94 | + public function getLastModified() { |
|
95 | + return $this->node->getLastModified(); |
|
96 | + } |
|
97 | 97 | } |