aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/lib/DAV/Xml/Property/LocalHref.php
blob: 76a27b95dd35dda3967a57dbda44f12664ac76cf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php

namespace Sabre\DAV\Xml\Property;

use Sabre\HTTP;

/**
 * LocalHref property
 *
 * Like the Href property, this element represents {DAV:}href. The difference
 * is that this is used stricly for paths on the server. The LocalHref property
 * will prepare the path so it's a valid URI.
 *
 * These two objects behave identically:
 *    new LocalHref($path)
 *    new Href(\Sabre\HTTP\encodePath($path))
 *
 * LocalPath basically ensures that your spaces are %20, and everything that
 * needs to be is uri encoded.
 *
 * @copyright Copyright (C) fruux GmbH (https://fruux.com/)
 * @author Evert Pot (http://www.rooftopsolutions.nl/)
 * @license http://sabre.io/license/ Modified BSD License
 */
class LocalHref extends Href {

    /**
     * Constructor
     *
     * You must either pass a string for a single href, or an array of hrefs.
     *
     * If auto-prefix is set to false, the hrefs will be treated as absolute
     * and not relative to the servers base uri.
     *
     * @param string|string[] $href
     */
    function __construct($hrefs) {

        parent::__construct(array_map(
            function($href) {
                return \Sabre\HTTP\encodePath($href);
            },
            (array)$hrefs
        ));

    }

}