PageRenderTime 35ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/vendor/nooku/libraries/koowa/filter/dirname.php

https://github.com/bhar1red/anahita
PHP | 41 lines | 14 code | 2 blank | 25 comment | 0 complexity | 242b2d9795e156f4df396f06a2234a3e MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  1. <?php
  2. /**
  3. * @version $Id: dirname.php 4628 2012-05-06 19:56:43Z johanjanssens $
  4. * @package Koowa_Filter
  5. * @copyright Copyright (C) 2007 - 2012 Johan Janssens. All rights reserved.
  6. * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
  7. * @link http://www.nooku.org
  8. */
  9. /**
  10. * Dirname filter
  11. *
  12. * @author Johan Janssens <johan@nooku.org>
  13. * @package Koowa_Filter
  14. */
  15. class KFilterDirname extends KFilterAbstract
  16. {
  17. /**
  18. * Validate a value
  19. *
  20. * @param scalar Variable to be validated
  21. * @return bool True when the variable is valid
  22. */
  23. protected function _validate($value)
  24. {
  25. $value = trim($value);
  26. return ((string) $value === $this->sanitize($value));
  27. }
  28. /**
  29. * Sanitize a value
  30. *
  31. * @param scalar Variable to be sanitized
  32. * @return string
  33. */
  34. protected function _sanitize($value)
  35. {
  36. $value = trim($value);
  37. return dirname($value);
  38. }
  39. }