ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\DAV\TreeDirectoryTester Class Reference
+ Inheritance diagram for Sabre\DAV\TreeDirectoryTester:
+ Collaboration diagram for Sabre\DAV\TreeDirectoryTester:

Public Member Functions

 createDirectory ($name)
 Creates a new subdirectory. More...
 
 createFile ($name, $data=null)
 Creates a new file in the directory. More...
 
 getChild ($name)
 Returns a child object, by its name. More...
 
 childExists ($name)
 Checks is a child-node exists. More...
 
 delete ()
 Deletes the current node. More...
 
 setName ($name)
 Renames the node. More...
 
- Public Member Functions inherited from Sabre\DAV\SimpleCollection
 __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...
 
 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...
 
 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...
 
 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...
 

Data Fields

 $newDirectories = []
 
 $newFiles = []
 
 $isDeleted = false
 
 $isRenamed = false
 

Additional Inherited Members

- Protected Attributes inherited from Sabre\DAV\SimpleCollection
 $children = []
 
 $name
 

Detailed Description

Definition at line 114 of file TreeTest.php.

Member Function Documentation

◆ childExists()

Sabre\DAV\TreeDirectoryTester::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

Reimplemented from Sabre\DAV\Collection.

Definition at line 141 of file TreeTest.php.

141 {
142
143 return !!$this->getChild($name);
144
145 }
getChild($name)
Returns a child object, by its name.
Definition: TreeTest.php:133

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

+ Here is the call graph for this function:

◆ createDirectory()

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

Creates a new subdirectory.

Parameters
string$name
Exceptions
Exception

Forbidden

Returns
void

Reimplemented from Sabre\DAV\Collection.

Definition at line 121 of file TreeTest.php.

121 {
122
123 $this->newDirectories[$name] = true;
124
125 }

References Sabre\DAV\SimpleCollection\$name.

◆ createFile()

Sabre\DAV\TreeDirectoryTester::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

Reimplemented from Sabre\DAV\Collection.

Definition at line 127 of file TreeTest.php.

127 {
128
129 $this->newFiles[$name] = $data;
130
131 }
$data
Definition: bench.php:6

References $data, and Sabre\DAV\SimpleCollection\$name.

◆ delete()

Sabre\DAV\TreeDirectoryTester::delete ( )

Deletes the current node.

Exceptions
Exception

Forbidden

Returns
void

Reimplemented from Sabre\DAV\Node.

Definition at line 147 of file TreeTest.php.

147 {
148
149 $this->isDeleted = true;
150
151 }

◆ getChild()

Sabre\DAV\TreeDirectoryTester::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

Reimplemented from Sabre\DAV\SimpleCollection.

Definition at line 133 of file TreeTest.php.

133 {
134
135 if (isset($this->newDirectories[$name])) return new self($name);
136 if (isset($this->newFiles[$name])) return new TreeFileTester($name, $this->newFiles[$name]);
137 return parent::getChild($name);
138
139 }

References Sabre\DAV\SimpleCollection\$name.

Referenced by Sabre\DAV\TreeDirectoryTester\childExists(), and Sabre\DAV\TreeMultiGetTester\getMultipleChildren().

+ Here is the caller graph for this function:

◆ setName()

Sabre\DAV\TreeDirectoryTester::setName (   $name)

Renames the node.

Parameters
string$nameThe new name
Exceptions
Exception

Forbidden

Returns
void

Reimplemented from Sabre\DAV\Node.

Definition at line 153 of file TreeTest.php.

153 {
154
155 $this->isRenamed = true;
156 $this->name = $name;
157
158 }

References Sabre\DAV\SimpleCollection\$name.

Field Documentation

◆ $isDeleted

Sabre\DAV\TreeDirectoryTester::$isDeleted = false

Definition at line 118 of file TreeTest.php.

◆ $isRenamed

Sabre\DAV\TreeDirectoryTester::$isRenamed = false

Definition at line 119 of file TreeTest.php.

◆ $newDirectories

Sabre\DAV\TreeDirectoryTester::$newDirectories = []

Definition at line 116 of file TreeTest.php.

◆ $newFiles

Sabre\DAV\TreeDirectoryTester::$newFiles = []

Definition at line 117 of file TreeTest.php.


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