Mercurial > hg > rc1
comparison vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php @ 7:430dbd5346f7
vendor sabre as distributed
author | Charlie Root |
---|---|
date | Sat, 13 Jan 2018 09:06:10 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
6:cec75ba50afc | 7:430dbd5346f7 |
---|---|
1 <?php | |
2 | |
3 namespace Sabre\VObject\Property\ICalendar; | |
4 | |
5 use | |
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) 2011-2015 fruux GmbH (https://fruux.com/). | |
14 * @author Evert Pot (http://evertpot.com/) | |
15 * @license http://sabre.io/license/ Modified BSD License | |
16 */ | |
17 class 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 public 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 public 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 } |