[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/zendframework/zend-stdlib/src/Hydrator/Filter/ -> MethodMatchFilter.php (source)

   1  <?php
   2  /**
   3   * Zend Framework (http://framework.zend.com/)
   4   *
   5   * @link           http://github.com/zendframework/zf2 for the canonical source repository
   6   * @copyright      Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
   7   * @license        http://framework.zend.com/license/new-bsd New BSD License
   8   */
   9  namespace Zend\Stdlib\Hydrator\Filter;
  10  
  11  class MethodMatchFilter implements FilterInterface
  12  {
  13      /**
  14       * The method to exclude
  15       * @var string
  16       */
  17      protected $method = null;
  18  
  19      /**
  20       * Either an exclude or an include
  21       * @var bool
  22       */
  23      protected $exclude = null;
  24  
  25      /**
  26       * @param string $method The method to exclude or include
  27       * @param bool $exclude If the method should be excluded
  28       */
  29      public function __construct($method, $exclude = true)
  30      {
  31          $this->method = $method;
  32          $this->exclude = $exclude;
  33      }
  34  
  35      public function filter($property)
  36      {
  37          $pos = strpos($property, '::');
  38          if ($pos !== false) {
  39              $pos += 2;
  40          } else {
  41              $pos = 0;
  42          }
  43          if (substr($property, $pos) === $this->method) {
  44              return !$this->exclude;
  45          }
  46          return $this->exclude;
  47      }
  48  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1