Boolean.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace Sabre\VObject\Property;
  3. use
  4. Sabre\VObject\Property;
  5. /**
  6. * Boolean property
  7. *
  8. * This object represents BOOLEAN values. These are always the case-insenstive
  9. * string TRUE or FALSE.
  10. *
  11. * Automatic conversion to PHP's true and false are done.
  12. *
  13. * @copyright Copyright (C) 2007-2014 fruux GmbH. All rights reserved.
  14. * @author Evert Pot (http://evertpot.com/)
  15. * @license http://sabre.io/license/ Modified BSD License
  16. */
  17. class Boolean extends Property {
  18. /**
  19. * Sets a raw value coming from a mimedir (iCalendar/vCard) file.
  20. *
  21. * This has been 'unfolded', so only 1 line will be passed. Unescaping is
  22. * not yet done, but parameters are not included.
  23. *
  24. * @param string $val
  25. * @return void
  26. */
  27. public function setRawMimeDirValue($val) {
  28. $val = strtoupper($val)==='TRUE'?true:false;
  29. $this->setValue($val);
  30. }
  31. /**
  32. * Returns a raw mime-dir representation of the value.
  33. *
  34. * @return string
  35. */
  36. public function getRawMimeDirValue() {
  37. return $this->value?'TRUE':'FALSE';
  38. }
  39. /**
  40. * Returns the type of value.
  41. *
  42. * This corresponds to the VALUE= parameter. Every property also has a
  43. * 'default' valueType.
  44. *
  45. * @return string
  46. */
  47. public function getValueType() {
  48. return 'BOOLEAN';
  49. }
  50. }