Comparable.php 839 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace Doctrine\Common;
  3. /**
  4. * Comparable interface that allows to compare two value objects to each other for similarity.
  5. *
  6. * @link www.doctrine-project.org
  7. * @since 2.2
  8. * @author Benjamin Eberlei <kontakt@beberlei.de>
  9. * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
  10. */
  11. interface Comparable
  12. {
  13. /**
  14. * Compares the current object to the passed $other.
  15. *
  16. * Returns 0 if they are semantically equal, 1 if the other object
  17. * is less than the current one, or -1 if its more than the current one.
  18. *
  19. * This method should not check for identity using ===, only for semantical equality for example
  20. * when two different DateTime instances point to the exact same Date + TZ.
  21. *
  22. * @param mixed $other
  23. *
  24. * @return int
  25. */
  26. public function compareTo($other);
  27. }