You are here

public function FilterComposite::__construct in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-hydrator/src/Filter/FilterComposite.php \Zend\Hydrator\Filter\FilterComposite::__construct()

Define default Filter

Parameters

array $orFilter:

array $andFilter:

Throws

InvalidArgumentException

File

vendor/zendframework/zend-hydrator/src/Filter/FilterComposite.php, line 44

Class

FilterComposite

Namespace

Zend\Hydrator\Filter

Code

public function __construct($orFilter = [], $andFilter = []) {
  array_walk($orFilter, function ($value, $key) {
    if (!is_callable($value) && !$value instanceof FilterInterface) {
      throw new InvalidArgumentException('The value of ' . $key . ' should be either a callable or ' . 'an instance of Zend\\Stdlib\\Hydrator\\Filter\\FilterInterface');
    }
  });
  array_walk($andFilter, function ($value, $key) {
    if (!is_callable($value) && !$value instanceof FilterInterface) {
      throw new InvalidArgumentException('The value of ' . $key . '  should be either a callable or ' . 'an instance of Zend\\Stdlib\\Hydrator\\Filter\\FilterInterface');
    }
  });
  $this->orFilter = new ArrayObject($orFilter);
  $this->andFilter = new ArrayObject($andFilter);
}