ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
PropertiesCollection.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Sabre\DAV\Mock;
4 
7 
15 class PropertiesCollection extends Collection implements IProperties {
16 
17  public $failMode = false;
18 
19  public $properties;
20 
29  function __construct($name, array $children, array $properties = []) {
30 
31  parent::__construct($name, $children, null);
32  $this->properties = $properties;
33 
34  }
35 
48  function propPatch(PropPatch $proppatch) {
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  }
65 
81  function getProperties($requestedProperties) {
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  }
93 
94 }
This class represents a set of properties that are going to be updated.
Definition: PropPatch.php:20
A node specifically for testing property-related operations.
getProperties($requestedProperties)
Returns a list of properties for this nodes.
propPatch(PropPatch $proppatch)
Updates properties on this node.
Collection class.
Definition: Collection.php:15
$r
Definition: example_031.php:79
IProperties interface.
Definition: IProperties.php:14
__construct($name, array $children, array $properties=[])
Creates the object.
handleRemaining(callable $callback)
Call this function if you wish to handle all properties that haven&#39;t been handled by anything else ye...
Definition: PropPatch.php:123