1. sfOutputEscaperGetterDecorator.class.php
  2. /** * Abstract output escaping decorator class for "getter" objects. * * @see sfOutputEscaper * @package symfony * @subpackage view * @author Mike Squire * @version SVN: $Id: sfOutputEscaperGetterDecorator.class.php 9047 2008-05-19 08:43:05Z FabianLange $ */
  3. abstract class sfOutputEscaperGetterDecorator extends sfOutputEscaper
  4. {
  5. /**
  6. * Returns the raw, unescaped value associated with the key supplied.
  7. *
  8. * The key might be an index into an array or a value to be passed to the
  9. * decorated object's get() method.
  10. *
  11. * @param string $key The key to retrieve
  12. *
  13. * @return mixed The value
  14. */
  15. public abstract function getRaw($key);
  16. /**
  17. * Returns the escaped value associated with the key supplied.
  18. *
  19. * Typically (using this implementation) the raw value is obtained using the
  20. * {@link getRaw()} method, escaped and the result returned.
  21. *
  22. * @param string $key The key to retieve
  23. * @param string $escapingMethod The escaping method (a PHP function) to use
  24. *
  25. * @return mixed The escaped value
  26. */
  27. public function get($key, $escapingMethod = null)
  28. {
  29. if (!$escapingMethod)
  30. {
  31. $escapingMethod = $this->escapingMethod;
  32. }
  33. return sfOutputEscaper::escape($escapingMethod, $this->getRaw($key));
  34. }
  35. }

Debug toolbar