Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
TypeDescription Class Reference
Inheritance diagram for TypeDescription:
ClassTypeDescription PrimitiveTypeDescription XMLTypeDescription MetadataTypeDescription ValidatorTypeDescription

Public Member Functions

 _parseTypeNameInternally ($typeName)
 
 checkType (&$object)
 
 getNamespace ()
 
 getTypeDescription ()
 
 getTypeName ()
 
 isCompatible ($object)
 
 parseTypeName ($typeName)
 
 TypeDescription ($typeName)
 

Public Attributes

 $_cardinality
 
 $_typeName
 

Detailed Description

Abstract base class for filter input/output type descriptions.

Filter type specifications need to fulfill the following requirements: 1) They must uniquely and reliably identify the input/output types supported by a filter. 2) They must be flexible enough to deal with type polymorphism (e.g. a generic XSL filter may accept several XML input formats while a specialized crosswalk filter may only accept a very specific XML encoding as input) or inheritance (e.g. when checking the class of an object). 3) Type definitions must be consistent across all filters (even those contributed by community plugins). 4) Type descriptions must be flexible enough so that new types can always be introduced, even by the community. 5) Type descriptions should have a unique string representation that is easy to read by humans and can be persisted. The string must contain all information necessary to instantiate the type description object.

String representations of type descriptions consist of two parts:

  • the first part identifies the type description class
  • the second part contains parameters that a specific type description class needs to actually check a type The two parts are separated by a double colon.

Example: "primitive::string"

See Also
TypeDescriptionFactory for more details about the type description string representation.
FilterDAO for more details about how type descriptions are used to choose compatible filters for a given input/output type.

Definition at line 49 of file TypeDescription.inc.php.

Member Function Documentation

TypeDescription::_parseTypeNameInternally (   $typeName)

Takes a type name and parses the cardinality part of it then delegate to the subclass to do the type-specific parsing.

Parameters
$typeNamestring

Definition at line 197 of file TypeDescription.inc.php.

TypeDescription::checkType ( $object)

Validates an object against the internal type description.

Parameters
$objectmixed
Returns
boolean

Definition at line 181 of file TypeDescription.inc.php.

TypeDescription::getNamespace ( )

Get the type description's namespace string

Returns
string

Definition at line 95 of file TypeDescription.inc.php.

TypeDescription::getTypeDescription ( )

Get the full unparsed type description

Returns
string

Definition at line 112 of file TypeDescription.inc.php.

TypeDescription::getTypeName ( )

Get the unparsed type name

Returns
string

Definition at line 104 of file TypeDescription.inc.php.

TypeDescription::isCompatible (   $object)

Checks whether the given object complies with the type description.

Parameters
$objectmixed
Returns
boolean

Definition at line 126 of file TypeDescription.inc.php.

TypeDescription::parseTypeName (   $typeName)

Parse a type name

Parameters
$typeNamestring
Returns
boolean true if success, otherwise false

Definition at line 170 of file TypeDescription.inc.php.

TypeDescription::TypeDescription (   $typeName)

Constructor

Parameters
$typeNamestring A plain text type name to be parsed by this type description class.

Type names can be any string. This base class provides a basic implementation for type cardinality (array-types) which can be re-used by all subclasses.

We currently do not support heterogeneous or multi-dimensional arrays because we don't have corresponding use cases. We may, however, expand our syntax later to accommodate that.

If you do not know the exact count of an array then you can leave the parentheses empty ([]).

Definition at line 79 of file TypeDescription.inc.php.

Member Data Documentation

integer TypeDescription::$_cardinality

the cardinality of the type

Definition at line 60 of file TypeDescription.inc.php.

string TypeDescription::$_typeName

the unparsed type name

Definition at line 54 of file TypeDescription.inc.php.


The documentation for this class was generated from the following file: