public function getValidator(PermissionInterface $permission)
    {
        /** @var ValidatorInterface|null $validator */
        $validator = $this->validatorPluginManager->get($permission->getValidator());

        if (!$validator) {
            throw new Exception\ValidatorNotFound(sprintf(
                'The validator \"%s\" could not be found',
                is_object($validator) ? get_class($validator) : gettype($validator)
            ));
        }

        if ($permission->getValidatorOptions()) {
            $json = $permission->getValidatorOptions();
            $options = json_decode($json, true);

            if (!$options) {
                throw new Exception\RuntimeException(sprintf(
                    'The options for validator \"%s\" must be in json format',
                    is_object($validator) ? get_class($validator) : gettype($validator)
                ));
            }

            foreach ($options as $method => $value) {
                $validator->{$method}($value);
            }
        }

        return $validator;
    }
public function getValidator(PermissionInterface $permission)
    {
        /** @var ValidatorInterface|null $validator */
        $validator = $this->validatorPluginManager->get($permission->getValidator());

        if (!$validator) {
            throw new Exception\ValidatorNotFound(sprintf(
                'The validator \"%s\" could not be found',
                is_object($validator) ? get_class($validator) : gettype($validator)
            ));
        }

        if ($permission->getValidatorOptions()) {
            $json = $permission->getValidatorOptions();
            $options = json_decode($json, true);

            if (!$options) {
                throw new Exception\RuntimeException(sprintf(
                    'The options for validator \"%s\" must be in json format',
                    is_object($validator) ? get_class($validator) : gettype($validator)
                ));
            }

            foreach ($options as $method => $value) {
                $validator->{$method}($value);
            }
        }

        return $validator;
    }
public function getValidator ( PermissionInterface $ permission ) { /** @var ValidatorInterface|null $validator */ $ validator = $ this -> validatorPluginManager -> get ( $ permission -> getValidator ( ) ) ; if ( ! $ validator ) { throw new Exception \ ValidatorNotFound ( sprintf ( 'The validator \"%s\" could not be found' , is_object ( $ validator ) ? get_class ( $ validator ) : gettype ( $ validator ) ) ) ; } if ( $ permission -> getValidatorOptions ( ) ) { $ json = $ permission -> getValidatorOptions ( ) ; $ options = json_decode ( $ json , true ) ; if ( ! $ options ) { throw new Exception \ RuntimeException ( sprintf ( 'The options for validator \"%s\" must be in json format' , is_object ( $ validator ) ? get_class ( $ validator ) : gettype ( $ validator ) ) ) ; } foreach ( $ options as $ method => $ value ) { $ validator -> { $ method } ( $ value ) ; } } return $ validator ; }
Get validator from entity

@param PermissionInterface $permission
@return null|ValidatorInterface
@throws \Eye4web\Zf2Abac\Exception\ValidatorNotFound
@throws \Eye4web\Zf2Abac\Exception\RuntimeException
Get validator from entity