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
9 namespace Zend\Stdlib\Hydrator\Filter
;
11 class MethodMatchFilter
implements FilterInterface
14 * The method to exclude
17 protected $method = null;
20 * Either an exclude or an include
23 protected $exclude = null;
26 * @param string $method The method to exclude or include
27 * @param bool $exclude If the method should be excluded
29 public function __construct($method, $exclude = true)
31 $this->method
= $method;
32 $this->exclude
= $exclude;
35 public function filter($property)
37 $pos = strpos($property, '::');
43 if (substr($property, $pos) === $this->method
) {
44 return $this->exclude ?
false : true;
46 return $this->exclude ?
true : false;