1<?php
2
3namespace Sabre\DAV\Xml\Property;
4
5use Sabre\HTTP;
6
7/**
8 * LocalHref property
9 *
10 * Like the Href property, this element represents {DAV:}href. The difference
11 * is that this is used strictly for paths on the server. The LocalHref property
12 * will prepare the path so it's a valid URI.
13 *
14 * These two objects behave identically:
15 *    new LocalHref($path)
16 *    new Href(\Sabre\HTTP\encodePath($path))
17 *
18 * LocalPath basically ensures that your spaces are %20, and everything that
19 * needs to be is uri encoded.
20 *
21 * @copyright Copyright (C) fruux GmbH (https://fruux.com/)
22 * @author Evert Pot (http://www.rooftopsolutions.nl/)
23 * @license http://sabre.io/license/ Modified BSD License
24 */
25class LocalHref extends Href {
26
27    /**
28     * Constructor
29     *
30     * You must either pass a string for a single href, or an array of hrefs.
31     *
32     * If auto-prefix is set to false, the hrefs will be treated as absolute
33     * and not relative to the servers base uri.
34     *
35     * @param string|string[] $hrefs
36     */
37    function __construct($hrefs) {
38
39        parent::__construct(array_map(
40            function($href) {
41                return \Sabre\HTTP\encodePath($href);
42            },
43            (array)$hrefs
44        ));
45
46    }
47
48}
49