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

A node specifically for testing property-related operations. More...

+ Inheritance diagram for Sabre\DAV\Mock\PropertiesCollection:
+ Collaboration diagram for Sabre\DAV\Mock\PropertiesCollection:

Public Member Functions

 __construct ($name, array $children, array $properties=[])
 Creates the object. More...
 
 propPatch (PropPatch $proppatch)
 Updates properties on this node. More...
 
 getProperties ($requestedProperties)
 Returns a list of properties for this nodes. 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...
 
- Public Member Functions inherited from Sabre\DAV\INode
 getName ()
 Returns the name of the node. More...
 
- Public Member Functions inherited from Sabre\DAV\ICollection
 getChildren ()
 Returns an array with all the child nodes. More...
 

Data Fields

 $failMode = false
 
 $properties
 

Detailed Description

A node specifically for testing property-related operations.

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

Definition at line 15 of file PropertiesCollection.php.

Constructor & Destructor Documentation

◆ __construct()

Sabre\DAV\Mock\PropertiesCollection::__construct (   $name,
array  $children,
array  $properties = [] 
)

Creates the object.

Parameters
string$name
array$children
array$properties
Returns
void

Definition at line 29 of file PropertiesCollection.php.

References $name, and Sabre\DAV\Mock\PropertiesCollection\$properties.

29  {
30 
31  parent::__construct($name, $children, null);
32  $this->properties = $properties;
33 
34  }

Member Function Documentation

◆ getProperties()

Sabre\DAV\Mock\PropertiesCollection::getProperties (   $requestedProperties)

Returns a list of properties for this nodes.

The properties list is a list of propertynames the client requested, encoded in clark-notation {xmlnamespace}tagname

If the array is empty, it means 'all properties' were requested.

Note that it's fine to liberally give properties back, instead of conforming to the list of requested properties. The Server class will filter out the extra.

Parameters
array$requestedProperties
Returns
array

Implements Sabre\DAV\IProperties.

Definition at line 81 of file PropertiesCollection.php.

81  {
82 
83  $returnedProperties = [];
84  foreach ($requestedProperties as $requestedProperty) {
85  if (isset($this->properties[$requestedProperty])) {
86  $returnedProperties[$requestedProperty] =
87  $this->properties[$requestedProperty];
88  }
89  }
90  return $returnedProperties;
91 
92  }

◆ propPatch()

Sabre\DAV\Mock\PropertiesCollection::propPatch ( PropPatch  $proppatch)

Updates properties on this node.

This method received a PropPatch object, which contains all the information about the update.

To update specific properties, call the 'handle' method on this object. Read the PropPatch documentation for more information.

Parameters
PropPatch$proppatch
Returns
bool|array

Implements Sabre\DAV\IProperties.

Definition at line 48 of file PropertiesCollection.php.

References $r, and Sabre\DAV\PropPatch\handleRemaining().

48  {
49 
50  $proppatch->handleRemaining(function($updateProperties) {
51 
52  switch ($this->failMode) {
53  case 'updatepropsfalse' : return false;
54  case 'updatepropsarray' :
55  $r = [];
56  foreach ($updateProperties as $k => $v) $r[$k] = 402;
57  return $r;
58  case 'updatepropsobj' :
59  return new \STDClass();
60  }
61 
62  });
63 
64  }
$r
Definition: example_031.php:79
+ Here is the call graph for this function:

Field Documentation

◆ $failMode

Sabre\DAV\Mock\PropertiesCollection::$failMode = false

Definition at line 17 of file PropertiesCollection.php.

◆ $properties

Sabre\DAV\Mock\PropertiesCollection::$properties

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