/** * @inheritDoc */ protected function validateArguments(array $args) { $valA1 = new HasTypeMap(['size' => 'integer']); $valA2 = new Lambda(function ($args) { return $args['size'] > 0; }, new StringType(self::ERR1)); $validator = new LAnd($valA1, $valA2); if (!$validator->isValid($args)) { throw new InvalidParameterException(implode(':', $validator->getMessages())); } }
/** * @inheritDoc */ protected function validateArguments(array $args) { $valA1 = new HasTypeMap(['rows' => 'integer', 'cols' => 'integer', 'f' => function ($val) { return $val instanceof \Closure; }]); $valA2 = new Lambda(function ($args) { return $args['rows'] > 0 && $args['cols'] > 0; }, new StringType(self::ERR1)); $validator = new LAnd($valA1, $valA2); if (!$validator->isValid($args)) { throw new InvalidParameterException(implode(':', $validator->getMessages())); } }