src/DB/PDO/Table.php
protected function checkField( $field, $mandatory = FALSE, $strict = TRUE ){
		if( !is_string( $field ) ){
			if( !$strict )
				return FALSE;
			throw new \InvalidArgumentException( 'Field must be a string' );
		}
		$field	= trim( $field );
		if( !strlen( $field ) ){
			if( $mandatory ){
				if( !$strict )
					return FALSE;
				throw new \InvalidArgumentException( 'Field must have a value' );
			}
			return NULL;
		}
		if( !in_array( $field, $this->columns ) ){
			if( !$strict )
				return FALSE;
			$message	= 'Field "%s" is not an existing column of table %s';
			throw new \InvalidArgumentException( sprintf( $message, $field, $this->getName() ) );
		}
		return $field;
	}
protected function checkField( $field, $mandatory = FALSE, $strict = TRUE ){
		if( !is_string( $field ) ){
			if( !$strict )
				return FALSE;
			throw new \InvalidArgumentException( 'Field must be a string' );
		}
		$field	= trim( $field );
		if( !strlen( $field ) ){
			if( $mandatory ){
				if( !$strict )
					return FALSE;
				throw new \InvalidArgumentException( 'Field must have a value' );
			}
			return NULL;
		}
		if( !in_array( $field, $this->columns ) ){
			if( !$strict )
				return FALSE;
			$message	= 'Field "%s" is not an existing column of table %s';
			throw new \InvalidArgumentException( sprintf( $message, $field, $this->getName() ) );
		}
		return $field;
	}
protected function checkField ( $ field , $ mandatory = FALSE , $ strict = TRUE ) { if ( ! is_string ( $ field ) ) { if ( ! $ strict ) return FALSE ; throw new \ InvalidArgumentException ( 'Field must be a string' ) ; } $ field = trim ( $ field ) ; if ( ! strlen ( $ field ) ) { if ( $ mandatory ) { if ( ! $ strict ) return FALSE ; throw new \ InvalidArgumentException ( 'Field must have a value' ) ; } return NULL ; } if ( ! in_array ( $ field , $ this -> columns ) ) { if ( ! $ strict ) return FALSE ; $ message = 'Field "%s" is not an existing column of table %s' ; throw new \ InvalidArgumentException ( sprintf ( $ message , $ field , $ this -> getName ( ) ) ) ; } return $ field ; }
Indicates whether a requested field is a table column.
Returns trimmed field key if found, otherwise FALSE if not a string or not a table column.
Returns FALSE if empty and mandatory, otherwise NULL.
In strict mode exceptions will be thrown if field is not a string, empty but mandatory or not a table column.
@access		protected
@param		string			$field			Table Column to check for existence
@param		string			$mandatory		Force a value, otherwise return NULL or throw exception in strict mode
@param		boolean			$strict			Strict mode (default): throw exception instead of returning FALSE or NULL
@return		string|NULL		Trimmed Field name if found, NULL otherwise or exception in strict mode
@throws		InvalidArgumentException		in strict mode if field is not a string and strict mode is on
@throws		InvalidArgumentException		in strict mode if field is empty but mandatory
@throws		InvalidArgumentException		in strict mode if field is not a table column
Indicates whether a requested field is a table column . Returns trimmed field key if found otherwise FALSE if not a string or not a table column . Returns FALSE if empty and mandatory otherwise NULL . In strict mode exceptions will be thrown if field is not a string empty but mandatory or not a table column .