public function validate($value)
    {
        $result = Ok::unit();

        foreach ($this->allowedTypes as $type) {
            $typeChecker = preg_match('/^&/', $type) ? $this->getCustomType($type) : $this->createProperty($type);
            $result = $typeChecker->validate($value);

            if ($result instanceof Ok) {
                return $result;
            }
        }
        return $result;
    }
public function validate($value)
    {
        $result = Ok::unit();

        foreach ($this->allowedTypes as $type) {
            $typeChecker = preg_match('/^&/', $type) ? $this->getCustomType($type) : $this->createProperty($type);
            $result = $typeChecker->validate($value);

            if ($result instanceof Ok) {
                return $result;
            }
        }
        return $result;
    }
public function validate ( $ value ) { $ result = Ok :: unit ( ) ; foreach ( $ this -> allowedTypes as $ type ) { $ typeChecker = preg_match ( '/^&/' , $ type ) ? $ this -> getCustomType ( $ type ) : $ this -> createProperty ( $ type ) ; $ result = $ typeChecker -> validate ( $ value ) ; if ( $ result instanceof Ok ) { return $ result ; } } return $ result ; }
Tells if a given value adhere's to one of the property's allowed types.

@param mixed $value

@return ResultInterface Returns Ok if the value is valid, otherwise an Error is returned.
Tells if a given value adhere s to one of the property s allowed types .