converter.class.php 668 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * Convert text. Used mostly to convert from one encoding to another.
  4. *
  5. * @copyright (c) 2012 University of Geneva
  6. * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
  7. * @author Laurent Opprecht <laurent@opprecht.info>
  8. */
  9. class Converter
  10. {
  11. /**
  12. * Identity converter. Returns the string with no transformations.
  13. *
  14. * @return Converter
  15. */
  16. public static function identity()
  17. {
  18. static $result = null;
  19. if(empty($result))
  20. {
  21. $result = new self();
  22. }
  23. return $result;
  24. }
  25. function convert($string)
  26. {
  27. return $string;
  28. }
  29. }