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