Mercurial > hg > rc1
comparison vendor/sabre/vobject/lib/Property/Integer.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; | |
| 4 | |
| 5 use | |
| 6 Sabre\VObject\Property; | |
| 7 | |
| 8 /** | |
| 9 * Integer property | |
| 10 * | |
| 11 * This object represents INTEGER values. These are always a single integer. | |
| 12 * They may be preceeded by either + or -. | |
| 13 * | |
| 14 * @copyright Copyright (C) 2011-2015 fruux GmbH (https://fruux.com/). | |
| 15 * @author Evert Pot (http://evertpot.com/) | |
| 16 * @license http://sabre.io/license/ Modified BSD License | |
| 17 */ | |
| 18 class Integer extends Property { | |
| 19 | |
| 20 /** | |
| 21 * Sets a raw value coming from a mimedir (iCalendar/vCard) file. | |
| 22 * | |
| 23 * This has been 'unfolded', so only 1 line will be passed. Unescaping is | |
| 24 * not yet done, but parameters are not included. | |
| 25 * | |
| 26 * @param string $val | |
| 27 * @return void | |
| 28 */ | |
| 29 public function setRawMimeDirValue($val) { | |
| 30 | |
| 31 $this->setValue((int)$val); | |
| 32 | |
| 33 } | |
| 34 | |
| 35 /** | |
| 36 * Returns a raw mime-dir representation of the value. | |
| 37 * | |
| 38 * @return string | |
| 39 */ | |
| 40 public function getRawMimeDirValue() { | |
| 41 | |
| 42 return $this->value; | |
| 43 | |
| 44 } | |
| 45 | |
| 46 /** | |
| 47 * Returns the type of value. | |
| 48 * | |
| 49 * This corresponds to the VALUE= parameter. Every property also has a | |
| 50 * 'default' valueType. | |
| 51 * | |
| 52 * @return string | |
| 53 */ | |
| 54 public function getValueType() { | |
| 55 | |
| 56 return "INTEGER"; | |
| 57 | |
| 58 } | |
| 59 | |
| 60 /** | |
| 61 * Returns the value, in the format it should be encoded for json. | |
| 62 * | |
| 63 * This method must always return an array. | |
| 64 * | |
| 65 * @return array | |
| 66 */ | |
| 67 public function getJsonValue() { | |
| 68 | |
| 69 return array((int)$this->getValue()); | |
| 70 | |
| 71 } | |
| 72 } |
