ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\DAV\Collection Class Reference

Collection class. More...

+ Inheritance diagram for Sabre\DAV\Collection:
+ Collaboration diagram for Sabre\DAV\Collection:

Public Member Functions

 getChild ($name)
 Returns a child object, by its name. More...
 
 childExists ($name)
 Checks is a child-node exists. More...
 
 createFile ($name, $data=null)
 Creates a new file in the directory. More...
 
 createDirectory ($name)
 Creates a new subdirectory. More...
 
- Public Member Functions inherited from Sabre\DAV\Node
 getLastModified ()
 Returns the last modification time as a unix timestamp. More...
 
 delete ()
 Deletes the current node. More...
 
 setName ($name)
 Renames the node. More...
 
- Public Member Functions inherited from Sabre\DAV\INode
 delete ()
 Deleted the current node. More...
 
 getName ()
 Returns the name of the node. More...
 
 setName ($name)
 Renames the node. More...
 
 getLastModified ()
 Returns the last modification time, as a unix timestamp. More...
 
- Public Member Functions inherited from Sabre\DAV\ICollection
 createFile ($name, $data=null)
 Creates a new file in the directory. More...
 
 createDirectory ($name)
 Creates a new subdirectory. More...
 
 getChild ($name)
 Returns a specific child node, referenced by its name. More...
 
 getChildren ()
 Returns an array with all the child nodes. More...
 
 childExists ($name)
 Checks if a child-node with the specified name exists. More...
 

Detailed Description

Collection class.

This is a helper class, that should aid in getting collections classes setup. Most of its methods are implemented, and throw permission denied exceptions

Author
Evert Pot (http://evertpot.com/) @license http://sabre.io/license/ Modified BSD License

Definition at line 15 of file Collection.php.

Member Function Documentation

◆ childExists()

Sabre\DAV\Collection::childExists (   $name)

Checks is a child-node exists.

It is generally a good idea to try and override this. Usually it can be optimized.

Parameters
string$name
Returns
bool

Implements Sabre\DAV\ICollection.

Reimplemented in Sabre\DAV\TreeDirectoryTester.

Definition at line 50 of file Collection.php.

50 {
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 }
getChild($name)
Returns a child object, by its name.
Definition: Collection.php:31

References $name, and Sabre\DAV\Collection\getChild().

+ Here is the call graph for this function:

◆ createDirectory()

Sabre\DAV\Collection::createDirectory (   $name)

Creates a new subdirectory.

Parameters
string$name
Exceptions
Exception

Forbidden

Returns
void

Implements Sabre\DAV\ICollection.

Reimplemented in Sabre\CardDAV\AddressBookHome, Sabre\CardDAV\AddressBook, Sabre\DAV\Mock\Collection, and Sabre\DAV\TreeDirectoryTester.

Definition at line 102 of file Collection.php.

102 {
103
104 throw new Exception\Forbidden('Permission denied to create directory');
105
106 }

◆ createFile()

Sabre\DAV\Collection::createFile (   $name,
  $data = null 
)

Creates a new file in the directory.

Data will either be supplied as a stream resource, or in certain cases as a string. Keep in mind that you may have to support either.

After successful creation of the file, you may choose to return the ETag of the new file here.

The returned ETag must be surrounded by double-quotes (The quotes should be part of the actual string).

If you cannot accurately determine the ETag, you should not return it. If you don't store the file exactly as-is (you're transforming it somehow) you should also not return an ETag.

This means that if a subsequent GET to this new file does not exactly return the same contents of what was submitted here, you are strongly recommended to omit the ETag.

Parameters
string$nameName of the file
resource | string$dataInitial payload
Returns
null|string

Implements Sabre\DAV\ICollection.

Reimplemented in Sabre\CardDAV\AddressBookHome, Sabre\CalDAV\Schedule\Inbox, Sabre\DAV\Mock\Collection, Sabre\DAV\TreeDirectoryTester, and Sabre\CardDAV\AddressBook.

Definition at line 89 of file Collection.php.

89 {
90
91 throw new Exception\Forbidden('Permission denied to create file (filename ' . $name . ')');
92
93 }

References $name.

◆ getChild()

Sabre\DAV\Collection::getChild (   $name)

Returns a child object, by its name.

This method makes use of the getChildren method to grab all the child nodes, and compares the name. Generally its wise to override this, as this can usually be optimized

This method must throw Sabre\DAV\Exception\NotFound if the node does not exist.

Parameters
string$name
Exceptions
Exception

NotFound

Returns
INode

Implements Sabre\DAV\ICollection.

Reimplemented in Sabre\CardDAV\AddressBook, Sabre\CardDAV\AddressBookHome, Sabre\DAV\SimpleCollection, Sabre\DAVACL\AbstractPrincipalCollection, and Sabre\DAV\TreeDirectoryTester.

Definition at line 31 of file Collection.php.

31 {
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 }
getChildren()
Returns an array with all the child nodes.

References $name, and Sabre\DAV\ICollection\getChildren().

Referenced by Sabre\DAV\Collection\childExists().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: