1<?php
2
3namespace Sabre\DAVACL\Xml\Request;
4
5use Sabre\Xml\Reader;
6use Sabre\Xml\XmlDeserializable;
7use Sabre\DAV\Exception\BadRequest;
8
9/**
10 * PrincipalSearchPropertySetReport request parser.
11 *
12 * This class parses the {DAV:}principal-search-property-set REPORT, as defined
13 * in:
14 *
15 * https://tools.ietf.org/html/rfc3744#section-9.5
16 *
17 * @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/).
18 * @author Evert Pot (http://evertpot.com/)
19 * @license http://sabre.io/license/ Modified BSD License
20 */
21class PrincipalSearchPropertySetReport implements XmlDeserializable {
22
23    /**
24     * The deserialize method is called during xml parsing.
25     *
26     * This method is called statictly, this is because in theory this method
27     * may be used as a type of constructor, or factory method.
28     *
29     * Often you want to return an instance of the current class, but you are
30     * free to return other data as well.
31     *
32     * You are responsible for advancing the reader to the next element. Not
33     * doing anything will result in a never-ending loop.
34     *
35     * If you just want to skip parsing for this element altogether, you can
36     * just call $reader->next();
37     *
38     * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
39     * the next element.
40     *
41     * @param Reader $reader
42     * @return mixed
43     */
44    static function xmlDeserialize(Reader $reader) {
45
46        if (!$reader->isEmptyElement) {
47            throw new BadRequest('The {DAV:}principal-search-property-set element must be empty');
48        }
49
50        // The element is actually empty, so there's not much to do.
51        $reader->next();
52
53        $self = new self();
54        return $self;
55
56    }
57
58}
59