CalAddress.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace Sabre\VObject\Property\ICalendar;
  3. use
  4. Sabre\VObject\Property\Text;
  5. /**
  6. * CalAddress property
  7. *
  8. * This object encodes CAL-ADDRESS values, as defined in rfc5545
  9. *
  10. * @copyright Copyright (C) 2007-2014 fruux GmbH. All rights reserved.
  11. * @author Evert Pot (http://evertpot.com/)
  12. * @license http://sabre.io/license/ Modified BSD License
  13. */
  14. class CalAddress extends Text {
  15. /**
  16. * In case this is a multi-value property. This string will be used as a
  17. * delimiter.
  18. *
  19. * @var string|null
  20. */
  21. public $delimiter = null;
  22. /**
  23. * Returns the type of value.
  24. *
  25. * This corresponds to the VALUE= parameter. Every property also has a
  26. * 'default' valueType.
  27. *
  28. * @return string
  29. */
  30. public function getValueType() {
  31. return 'CAL-ADDRESS';
  32. }
  33. /**
  34. * This returns a normalized form of the value.
  35. *
  36. * This is primarily used right now to turn mixed-cased schemes in user
  37. * uris to lower-case.
  38. *
  39. * Evolution in particular tends to encode mailto: as MAILTO:.
  40. *
  41. * @return string
  42. */
  43. public function getNormalizedValue() {
  44. $input = $this->getValue();
  45. if (!strpos($input, ':')) {
  46. return $input;
  47. }
  48. list($schema, $everythingElse) = explode(':', $input, 2);
  49. return strtolower($schema) . ':' . $everythingElse;
  50. }
  51. }