annotate vendor/sabre/vobject/lib/Property/Boolean.php @ 7:430dbd5346f7

vendor sabre as distributed
author Charlie Root
date Sat, 13 Jan 2018 09:06:10 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
1 <?php
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
2
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
3 namespace Sabre\VObject\Property;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
4
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
5 use
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
6 Sabre\VObject\Property;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
7
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
8 /**
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
9 * Boolean property
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
10 *
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
11 * This object represents BOOLEAN values. These are always the case-insenstive
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
12 * string TRUE or FALSE.
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
13 *
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
14 * Automatic conversion to PHP's true and false are done.
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
15 *
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
16 * @copyright Copyright (C) 2011-2015 fruux GmbH (https://fruux.com/).
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
17 * @author Evert Pot (http://evertpot.com/)
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
18 * @license http://sabre.io/license/ Modified BSD License
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
19 */
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
20 class Boolean extends Property {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
21
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
22 /**
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
23 * Sets a raw value coming from a mimedir (iCalendar/vCard) file.
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
24 *
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
25 * This has been 'unfolded', so only 1 line will be passed. Unescaping is
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
26 * not yet done, but parameters are not included.
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
27 *
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
28 * @param string $val
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
29 * @return void
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
30 */
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
31 public function setRawMimeDirValue($val) {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
32
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
33 $val = strtoupper($val)==='TRUE'?true:false;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
34 $this->setValue($val);
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
35
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
36 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
37
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
38 /**
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
39 * Returns a raw mime-dir representation of the value.
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
40 *
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
41 * @return string
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
42 */
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
43 public function getRawMimeDirValue() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
44
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
45 return $this->value?'TRUE':'FALSE';
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
46
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
47 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
48
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
49 /**
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
50 * Returns the type of value.
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
51 *
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
52 * This corresponds to the VALUE= parameter. Every property also has a
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
53 * 'default' valueType.
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
54 *
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
55 * @return string
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
56 */
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
57 public function getValueType() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
58
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
59 return 'BOOLEAN';
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
60
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
61 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
62
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
63 }