Integer.php 1.5 KB

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