1*a1a3b679SAndreas Boehler<?php 2*a1a3b679SAndreas Boehler 3*a1a3b679SAndreas Boehlernamespace Sabre\DAV\Xml\Request; 4*a1a3b679SAndreas Boehler 5*a1a3b679SAndreas Boehleruse Sabre\Xml\Element\KeyValue; 6*a1a3b679SAndreas Boehleruse Sabre\Xml\Reader; 7*a1a3b679SAndreas Boehleruse Sabre\Xml\XmlDeserializable; 8*a1a3b679SAndreas Boehler 9*a1a3b679SAndreas Boehler/** 10*a1a3b679SAndreas Boehler * WebDAV PROPFIND request parser. 11*a1a3b679SAndreas Boehler * 12*a1a3b679SAndreas Boehler * This class parses the {DAV:}propfind request, as defined in: 13*a1a3b679SAndreas Boehler * 14*a1a3b679SAndreas Boehler * https://tools.ietf.org/html/rfc4918#section-14.20 15*a1a3b679SAndreas Boehler * 16*a1a3b679SAndreas Boehler * @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/). 17*a1a3b679SAndreas Boehler * @author Evert Pot (http://www.rooftopsolutions.nl/) 18*a1a3b679SAndreas Boehler * @license http://sabre.io/license/ Modified BSD License 19*a1a3b679SAndreas Boehler */ 20*a1a3b679SAndreas Boehlerclass PropFind implements XmlDeserializable { 21*a1a3b679SAndreas Boehler 22*a1a3b679SAndreas Boehler /** 23*a1a3b679SAndreas Boehler * If this is set to true, this was an 'allprop' request. 24*a1a3b679SAndreas Boehler * 25*a1a3b679SAndreas Boehler * @var bool 26*a1a3b679SAndreas Boehler */ 27*a1a3b679SAndreas Boehler public $allProp = false; 28*a1a3b679SAndreas Boehler 29*a1a3b679SAndreas Boehler /** 30*a1a3b679SAndreas Boehler * The property list 31*a1a3b679SAndreas Boehler * 32*a1a3b679SAndreas Boehler * @var null|array 33*a1a3b679SAndreas Boehler */ 34*a1a3b679SAndreas Boehler public $properties; 35*a1a3b679SAndreas Boehler 36*a1a3b679SAndreas Boehler /** 37*a1a3b679SAndreas Boehler * The deserialize method is called during xml parsing. 38*a1a3b679SAndreas Boehler * 39*a1a3b679SAndreas Boehler * This method is called statictly, this is because in theory this method 40*a1a3b679SAndreas Boehler * may be used as a type of constructor, or factory method. 41*a1a3b679SAndreas Boehler * 42*a1a3b679SAndreas Boehler * Often you want to return an instance of the current class, but you are 43*a1a3b679SAndreas Boehler * free to return other data as well. 44*a1a3b679SAndreas Boehler * 45*a1a3b679SAndreas Boehler * You are responsible for advancing the reader to the next element. Not 46*a1a3b679SAndreas Boehler * doing anything will result in a never-ending loop. 47*a1a3b679SAndreas Boehler * 48*a1a3b679SAndreas Boehler * If you just want to skip parsing for this element altogether, you can 49*a1a3b679SAndreas Boehler * just call $reader->next(); 50*a1a3b679SAndreas Boehler * 51*a1a3b679SAndreas Boehler * $reader->parseInnerTree() will parse the entire sub-tree, and advance to 52*a1a3b679SAndreas Boehler * the next element. 53*a1a3b679SAndreas Boehler * 54*a1a3b679SAndreas Boehler * @param Reader $reader 55*a1a3b679SAndreas Boehler * @return mixed 56*a1a3b679SAndreas Boehler */ 57*a1a3b679SAndreas Boehler static function xmlDeserialize(Reader $reader) { 58*a1a3b679SAndreas Boehler 59*a1a3b679SAndreas Boehler $self = new self(); 60*a1a3b679SAndreas Boehler 61*a1a3b679SAndreas Boehler $reader->pushContext(); 62*a1a3b679SAndreas Boehler $reader->elementMap['{DAV:}prop'] = 'Sabre\Xml\Element\Elements'; 63*a1a3b679SAndreas Boehler 64*a1a3b679SAndreas Boehler foreach (KeyValue::xmlDeserialize($reader) as $k => $v) { 65*a1a3b679SAndreas Boehler 66*a1a3b679SAndreas Boehler switch ($k) { 67*a1a3b679SAndreas Boehler case '{DAV:}prop' : 68*a1a3b679SAndreas Boehler $self->properties = $v; 69*a1a3b679SAndreas Boehler break; 70*a1a3b679SAndreas Boehler case '{DAV:}allprop' : 71*a1a3b679SAndreas Boehler $self->allProp = true; 72*a1a3b679SAndreas Boehler 73*a1a3b679SAndreas Boehler } 74*a1a3b679SAndreas Boehler 75*a1a3b679SAndreas Boehler } 76*a1a3b679SAndreas Boehler 77*a1a3b679SAndreas Boehler $reader->popContext(); 78*a1a3b679SAndreas Boehler 79*a1a3b679SAndreas Boehler return $self; 80*a1a3b679SAndreas Boehler 81*a1a3b679SAndreas Boehler } 82*a1a3b679SAndreas Boehler 83*a1a3b679SAndreas Boehler} 84