ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Collection.php
Go to the documentation of this file.
1<?php
2
3namespace Sabre\DAV;
4
15abstract class Collection extends Node implements ICollection {
16
31 function getChild($name) {
32
33 foreach ($this->getChildren() as $child) {
34
35 if ($child->getName() === $name) return $child;
36
37 }
38 throw new Exception\NotFound('File not found: ' . $name);
39
40 }
41
50 function childExists($name) {
51
52 try {
53
54 $this->getChild($name);
55 return true;
56
57 } catch (Exception\NotFound $e) {
58
59 return false;
60
61 }
62
63 }
64
89 function createFile($name, $data = null) {
90
91 throw new Exception\Forbidden('Permission denied to create file (filename ' . $name . ')');
92
93 }
94
103
104 throw new Exception\Forbidden('Permission denied to create directory');
105
106 }
107
108
109}
An exception for terminatinating execution or to throw for unit testing.
Collection class.
Definition: Collection.php:15
createDirectory($name)
Creates a new subdirectory.
Definition: Collection.php:102
getChild($name)
Returns a child object, by its name.
Definition: Collection.php:31
childExists($name)
Checks is a child-node exists.
Definition: Collection.php:50
createFile($name, $data=null)
Creates a new file in the directory.
Definition: Collection.php:89
Main Exception class.
Definition: Exception.php:18
Node class.
Definition: Node.php:14
The ICollection Interface.
Definition: ICollection.php:14
getChildren()
Returns an array with all the child nodes.
$data
Definition: bench.php:6