You are here

public function NumberOfParameterFilter::filter in Zircon Profile 8

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

Parameters

string $property the name of the property:

Return value

bool

Throws

InvalidArgumentException

Overrides FilterInterface::filter

File

vendor/zendframework/zend-hydrator/src/Filter/NumberOfParameterFilter.php, line 37

Class

NumberOfParameterFilter

Namespace

Zend\Hydrator\Filter

Code

public function filter($property) {
  try {
    $reflectionMethod = new ReflectionMethod($property);
  } catch (ReflectionException $exception) {
    throw new InvalidArgumentException("Method {$property} doesn't exist");
  }
  return $reflectionMethod
    ->getNumberOfParameters() === $this->numberOfParameters;
}