1<?php
2
3namespace Sabre\VObject\Property\ICalendar;
4
5use
6    Sabre\VObject\Property\Text;
7
8/**
9 * CalAddress property.
10 *
11 * This object encodes CAL-ADDRESS values, as defined in rfc5545
12 *
13 * @copyright Copyright (C) fruux GmbH (https://fruux.com/)
14 * @author Evert Pot (http://evertpot.com/)
15 * @license http://sabre.io/license/ Modified BSD License
16 */
17class CalAddress extends Text {
18
19    /**
20     * In case this is a multi-value property. This string will be used as a
21     * delimiter.
22     *
23     * @var string|null
24     */
25    public $delimiter = null;
26
27    /**
28     * Returns the type of value.
29     *
30     * This corresponds to the VALUE= parameter. Every property also has a
31     * 'default' valueType.
32     *
33     * @return string
34     */
35    function getValueType() {
36
37        return 'CAL-ADDRESS';
38
39    }
40
41    /**
42     * This returns a normalized form of the value.
43     *
44     * This is primarily used right now to turn mixed-cased schemes in user
45     * uris to lower-case.
46     *
47     * Evolution in particular tends to encode mailto: as MAILTO:.
48     *
49     * @return string
50     */
51    function getNormalizedValue() {
52
53        $input = $this->getValue();
54        if (!strpos($input, ':')) {
55            return $input;
56        }
57        list($schema, $everythingElse) = explode(':', $input, 2);
58        return strtolower($schema) . ':' . $everythingElse;
59
60    }
61}
62