You are here

class MethodMatchFilter in Zircon Profile 8

Same name in this branch
  1. 8 vendor/zendframework/zend-hydrator/src/Filter/MethodMatchFilter.php \Zend\Hydrator\Filter\MethodMatchFilter
  2. 8 vendor/zendframework/zend-stdlib/src/Hydrator/Filter/MethodMatchFilter.php \Zend\Stdlib\Hydrator\Filter\MethodMatchFilter
Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-hydrator/src/Filter/MethodMatchFilter.php \Zend\Hydrator\Filter\MethodMatchFilter

Hierarchy

Expanded class hierarchy of MethodMatchFilter

1 file declares its use of MethodMatchFilter
MethodMatchFilter.php in vendor/zendframework/zend-stdlib/src/Hydrator/Filter/MethodMatchFilter.php

File

vendor/zendframework/zend-hydrator/src/Filter/MethodMatchFilter.php, line 12

Namespace

Zend\Hydrator\Filter
View source
class MethodMatchFilter implements FilterInterface {

  /**
   * The method to exclude
   * @var string
   */
  protected $method = null;

  /**
   * Either an exclude or an include
   * @var bool
   */
  protected $exclude = null;

  /**
   * @param string $method The method to exclude or include
   * @param bool $exclude If the method should be excluded
   */
  public function __construct($method, $exclude = true) {
    $this->method = $method;
    $this->exclude = $exclude;
  }
  public function filter($property) {
    $pos = strpos($property, '::');
    if ($pos !== false) {
      $pos += 2;
    }
    else {
      $pos = 0;
    }
    if (substr($property, $pos) === $this->method) {
      return !$this->exclude;
    }
    return $this->exclude;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MethodMatchFilter::$exclude protected property Either an exclude or an include
MethodMatchFilter::$method protected property The method to exclude
MethodMatchFilter::filter public function Should return true, if the given filter does not match Overrides FilterInterface::filter
MethodMatchFilter::__construct public function