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

SimpleCollection. More...

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

Public Member Functions

 __construct ($name, array $children=[])
 Creates this node. More...
 
 addChild (INode $child)
 Adds a new childnode to this collection. More...
 
 getName ()
 Returns the name of the collection. More...
 
 getChild ($name)
 Returns a child object, by its name. More...
 
 getChildren ()
 Returns a list of children for this collection. More...
 
- Public Member Functions inherited from Sabre\DAV\Collection
 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...
 

Protected Attributes

 $children = []
 
 $name
 

Detailed Description

SimpleCollection.

The SimpleCollection is used to quickly setup static directory structures. Just create the object with a proper name, and add children to use it.

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

Definition at line 15 of file SimpleCollection.php.

Constructor & Destructor Documentation

◆ __construct()

Sabre\DAV\SimpleCollection::__construct (   $name,
array  $children = [] 
)

Creates this node.

The name of the node must be passed, child nodes can also be passed. This nodes must be instances of INode

Parameters
string$name
INode[]$children

Definition at line 40 of file SimpleCollection.php.

References Sabre\DAV\SimpleCollection\$children, Sabre\DAV\SimpleCollection\$name, and Sabre\DAV\SimpleCollection\addChild().

40  {
41 
42  $this->name = $name;
43  foreach ($children as $child) {
44 
45  if (!($child instanceof INode)) throw new Exception('Only instances of Sabre\DAV\INode are allowed to be passed in the children argument');
46  $this->addChild($child);
47 
48  }
49 
50  }
addChild(INode $child)
Adds a new childnode to this collection.
+ Here is the call graph for this function:

Member Function Documentation

◆ addChild()

Sabre\DAV\SimpleCollection::addChild ( INode  $child)

Adds a new childnode to this collection.

Parameters
INode$child
Returns
void

Definition at line 58 of file SimpleCollection.php.

References Sabre\DAV\INode\getName().

Referenced by Sabre\DAV\SimpleCollection\__construct().

58  {
59 
60  $this->children[$child->getName()] = $child;
61 
62  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getChild()

Sabre\DAV\SimpleCollection::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 if the node does not exist.

Parameters
string$name
Exceptions
Exception

Implements Sabre\DAV\ICollection.

Definition at line 88 of file SimpleCollection.php.

References Sabre\DAV\SimpleCollection\$name, and Sabre\DAV\SimpleCollection\getName().

88  {
89 
90  if (isset($this->children[$name])) return $this->children[$name];
91  throw new Exception\NotFound('File not found: ' . $name . ' in \'' . $this->getName() . '\'');
92 
93  }
getName()
Returns the name of the collection.
+ Here is the call graph for this function:

◆ getChildren()

Sabre\DAV\SimpleCollection::getChildren ( )

Returns a list of children for this collection.

Returns
INode[]

Implements Sabre\DAV\ICollection.

Definition at line 100 of file SimpleCollection.php.

Referenced by Sabre\DAV\Sync\MockSyncCollection\getChanges().

100  {
101 
102  return array_values($this->children);
103 
104  }
+ Here is the caller graph for this function:

◆ getName()

Sabre\DAV\SimpleCollection::getName ( )

Returns the name of the collection.

Returns
string

Implements Sabre\DAV\INode.

Definition at line 69 of file SimpleCollection.php.

References Sabre\DAV\SimpleCollection\$name.

Referenced by Sabre\DAV\SimpleCollection\getChild().

69  {
70 
71  return $this->name;
72 
73  }
+ Here is the caller graph for this function:

Field Documentation

◆ $children

Sabre\DAV\SimpleCollection::$children = []
protected

Definition at line 22 of file SimpleCollection.php.

Referenced by Sabre\DAV\SimpleCollection\__construct().

◆ $name

Sabre\DAV\SimpleCollection::$name
protected

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