ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
PrincipalPropertySearchReport.php
Go to the documentation of this file.
1 <?php
2 
4 
8 
22 
28  public $properties;
29 
35  public $searchProperties = [];
36 
45 
54  public $test;
55 
77  static function xmlDeserialize(Reader $reader) {
78 
79  $self = new self();
80 
81  $foundSearchProp = false;
82  $self->test = 'allof';
83  if ($reader->getAttribute('test') === 'anyof') {
84  $self->test = 'anyof';
85  }
86 
87  $elemMap = [
88  '{DAV:}property-search' => 'Sabre\\Xml\\Element\\KeyValue',
89  '{DAV:}prop' => 'Sabre\\Xml\\Element\\KeyValue',
90  ];
91 
92  foreach ($reader->parseInnerTree($elemMap) as $elem) {
93 
94  switch ($elem['name']) {
95 
96  case '{DAV:}prop' :
97  $self->properties = array_keys($elem['value']);
98  break;
99  case '{DAV:}property-search' :
100  $foundSearchProp = true;
101  // This property has two sub-elements:
102  // {DAV:}prop - The property to be searched on. This may
103  // also be more than one
104  // {DAV:}match - The value to match with
105  if (!isset($elem['value']['{DAV:}prop']) || !isset($elem['value']['{DAV:}match'])) {
106  throw new BadRequest('The {DAV:}property-search element must contain one {DAV:}match and one {DAV:}prop element');
107  }
108  foreach ($elem['value']['{DAV:}prop'] as $propName => $discard) {
109  $self->searchProperties[$propName] = $elem['value']['{DAV:}match'];
110  }
111  break;
112  case '{DAV:}apply-to-principal-collection-set' :
113  $self->applyToPrincipalCollectionSet = true;
114  break;
115 
116  }
117 
118  }
119  if (!$foundSearchProp) {
120  throw new BadRequest('The {DAV:}principal-property-search report must contain at least 1 {DAV:}property-search element');
121  }
122 
123  return $self;
124 
125  }
126 
127 }
parseInnerTree(array $elementMap=null)
Parses all elements below the current element.
Definition: Reader.php:129
static xmlDeserialize(Reader $reader)
The deserialize method is called during xml parsing.
The Reader class expands upon PHP&#39;s built-in XMLReader.
Definition: Reader.php:20
Implementing the XmlDeserializable interface allows you to use a class as a deserializer for a specif...
PrincipalSearchPropertySetReport request parser.