ICalendar
6 months ago
VCard
6 months ago
Binary.php
6 months ago
Boolean.php
6 months ago
FlatText.php
6 months ago
FloatValue.php
6 months ago
IntegerValue.php
6 months ago
Text.php
6 months ago
Time.php
6 months ago
Unknown.php
6 months ago
Uri.php
6 months ago
UtcOffset.php
6 months ago
IntegerValue.php
77 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AmeliaVendor\Sabre\VObject\Property; |
| 4 | |
| 5 | use AmeliaVendor\Sabre\VObject\Property; |
| 6 | |
| 7 | /** |
| 8 | * Integer property. |
| 9 | * |
| 10 | * This object represents INTEGER values. These are always a single integer. |
| 11 | * They may be preceded by either + or -. |
| 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 | */ |
| 17 | class IntegerValue extends Property |
| 18 | { |
| 19 | /** |
| 20 | * Sets a raw value coming from a mimedir (iCalendar/vCard) file. |
| 21 | * |
| 22 | * This has been 'unfolded', so only 1 line will be passed. Unescaping is |
| 23 | * not yet done, but parameters are not included. |
| 24 | * |
| 25 | * @param string $val |
| 26 | */ |
| 27 | public function setRawMimeDirValue($val) |
| 28 | { |
| 29 | $this->setValue((int) $val); |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * Returns a raw mime-dir representation of the value. |
| 34 | * |
| 35 | * @return string |
| 36 | */ |
| 37 | public function getRawMimeDirValue() |
| 38 | { |
| 39 | return $this->value; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Returns the type of value. |
| 44 | * |
| 45 | * This corresponds to the VALUE= parameter. Every property also has a |
| 46 | * 'default' valueType. |
| 47 | * |
| 48 | * @return string |
| 49 | */ |
| 50 | public function getValueType() |
| 51 | { |
| 52 | return 'INTEGER'; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Returns the value, in the format it should be encoded for json. |
| 57 | * |
| 58 | * This method must always return an array. |
| 59 | * |
| 60 | * @return array |
| 61 | */ |
| 62 | public function getJsonValue() |
| 63 | { |
| 64 | return [(int) $this->getValue()]; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Hydrate data from a XML subtree, as it would appear in a xCard or xCal |
| 69 | * object. |
| 70 | */ |
| 71 | public function setXmlValue(array $value) |
| 72 | { |
| 73 | $value = array_map('intval', $value); |
| 74 | parent::setXmlValue($value); |
| 75 | } |
| 76 | } |
| 77 |