src/Driver/Attribute/Support.php
public function validate( string $attributeName, $attributeValue ) : ValidationResult
   {

      $result = new ValidationResult();

      if ( false === $this->has( $attributeName ) )
      {
         // Unknown argument name
         return $result
            ->setErrorMessage( 'Unknown Driver attribute name "' . $attributeName . '"!' );
      }

      if ( $this->_attributes[ $attributeName ]->validateValue( $attributeValue ) )
      {
         // The value is valid we are done here
         return $result
            ->setIsKnown( true )
            ->setIsValidValue( true )
            ->setValue( $attributeValue );
      }

      if ( $this->_attributes[ $attributeName ]->hasDefaultValue() )
      {
         // The defined value is not valid, but a default value is defined, that is used now
         return $result
            ->setIsKnown( true )
            ->setValue( $this->_attributes[ $attributeName ]->getDefaultValue() );
      }

      return $result
         ->setIsKnown( true )
         ->setErrorMessage( 'Unknown Driver argument "' . $attributeName . '" value "' . $attributeValue . '"!' );

   }
public function validate( string $attributeName, $attributeValue ) : ValidationResult
   {

      $result = new ValidationResult();

      if ( false === $this->has( $attributeName ) )
      {
         // Unknown argument name
         return $result
            ->setErrorMessage( 'Unknown Driver attribute name "' . $attributeName . '"!' );
      }

      if ( $this->_attributes[ $attributeName ]->validateValue( $attributeValue ) )
      {
         // The value is valid we are done here
         return $result
            ->setIsKnown( true )
            ->setIsValidValue( true )
            ->setValue( $attributeValue );
      }

      if ( $this->_attributes[ $attributeName ]->hasDefaultValue() )
      {
         // The defined value is not valid, but a default value is defined, that is used now
         return $result
            ->setIsKnown( true )
            ->setValue( $this->_attributes[ $attributeName ]->getDefaultValue() );
      }

      return $result
         ->setIsKnown( true )
         ->setErrorMessage( 'Unknown Driver argument "' . $attributeName . '" value "' . $attributeValue . '"!' );

   }
public function validate ( string $ attributeName , $ attributeValue ) : ValidationResult { $ result = new ValidationResult ( ) ; if ( false === $ this -> has ( $ attributeName ) ) { // Unknown argument name return $ result -> setErrorMessage ( 'Unknown Driver attribute name "' . $ attributeName . '"!' ) ; } if ( $ this -> _attributes [ $ attributeName ] -> validateValue ( $ attributeValue ) ) { // The value is valid we are done here return $ result -> setIsKnown ( true ) -> setIsValidValue ( true ) -> setValue ( $ attributeValue ) ; } if ( $ this -> _attributes [ $ attributeName ] -> hasDefaultValue ( ) ) { // The defined value is not valid, but a default value is defined, that is used now return $ result -> setIsKnown ( true ) -> setValue ( $ this -> _attributes [ $ attributeName ] -> getDefaultValue ( ) ) ; } return $ result -> setIsKnown ( true ) -> setErrorMessage ( 'Unknown Driver argument "' . $ attributeName . '" value "' . $ attributeValue . '"!' ) ; }
Validates a Driver argument with defined name and value. At least it checks if the Driver knows the
argument and if the value is valid.

@param string $attributeName
@param        $attributeValue
@return \Niirrty\DB\Driver\Attribute\ValidationResult
Validates a Driver argument with defined name and value . At least it checks if the Driver knows the argument and if the value is valid .