src/Callbacks/ArrayValidatorCallback.php
/**
     * Will be invoked by a observer it has been registered for.
     *
     * @param string|null $attributeCode  The code of the attribute that has to be validated
     * @param string|null $attributeValue The attribute value to be validated
     *
     * @return mixed The modified value
     */
Will be invoked by a observer it has been registered for.
@param string|null $attributeCode  The code of the attribute that has to be validated
@param string|null $attributeValue The attribute value to be validated

@return mixed The modified value
Will be invoked by a observer it has been registered for . @param string|null $attributeCode The code of the attribute that has to be validated @param string|null $attributeValue The attribute value to be validated @return mixed The modified value
public function handle($attributeCode = null, $attributeValue = null)
    {
        $validations = $this->getValidations($attributeCode);
        if (in_array($attributeValue, $validations)) {
            return;
        }
        if ($this->isNullable($attributeValue)) {
            return;
        }
        if (sizeof($validations) === 0) {
            throw new \InvalidArgumentException(
                sprintf('Missing configuration value for custom validation of attribute "%s"', $attributeCode)
            );
        }
        throw new \InvalidArgumentException(
            sprintf(
                'Found invalid value "%s" for column "%s" (must be one of: "%s")',
                $attributeValue,
                $attributeCode,
                implode(', ', $validations)
            )
        );
    }
public function handle ( $ attributeCode = null , $ attributeValue = null ) { $ validations = $ this -> getValidations ( $ attributeCode ) ; if ( in_array ( $ attributeValue , $ validations ) ) { return ; } if ( $ this -> isNullable ( $ attributeValue ) ) { return ; } if ( sizeof ( $ validations ) === 0 ) { throw new \ InvalidArgumentException ( sprintf ( 'Missing configuration value for custom validation of attribute "%s"' , $ attributeCode ) ) ; } throw new \ InvalidArgumentException ( sprintf ( 'Found invalid value "%s" for column "%s" (must be one of: "%s")' , $ attributeValue , $ attributeCode , implode ( ', ' , $ validations ) ) ) ; }
Will be invoked by a observer it has been registered for.
Will be invoked by a observer it has been registered for .
// the validations for the attribute with the given code // if the passed value is in the array, return immediately // query whether or not the passed value IS empty and empty // values are allowed // throw an exception if NO allowed values have been configured // throw an exception if the value is NOT in the array