3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\Filter
;
12 class BaseName
extends AbstractFilter
15 * Defined by Zend\Filter\FilterInterface
17 * Returns basename($value).
19 * If the value provided is non-scalar, the value will remain unfiltered
20 * and an E_USER_WARNING will be raised indicating it's unfilterable.
22 * @param string $value
23 * @return string|mixed
25 public function filter($value)
27 if (null === $value) {
31 if (!is_scalar($value)) {
34 '%s expects parameter to be scalar, "%s" given; cannot filter',
36 (is_object($value) ?
get_class($value) : gettype($value))
43 return basename((string) $value);