Open Journal Systems  3.3.0
TypeDescription Class Reference
Inheritance diagram for TypeDescription:
ClassTypeDescription PrimitiveTypeDescription XMLTypeDescription MetadataTypeDescription ValidatorTypeDescription

Public Member Functions

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

Data Fields

 $_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.

Constructor & Destructor Documentation

◆ __construct()

TypeDescription::__construct (   $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 ([]).

Reimplemented in XMLTypeDescription, MetadataTypeDescription, ClassTypeDescription, ValidatorTypeDescription, and PrimitiveTypeDescription.

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

References _parseTypeNameInternally(), fatalError(), and getNamespace().

Member Function Documentation

◆ _parseTypeNameInternally()

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.

References parseTypeName().

Referenced by __construct().

◆ checkType()

TypeDescription::checkType ( $object)

Validates an object against the internal type description.

Parameters
$objectmixed
Returns
boolean

Reimplemented in MetadataTypeDescription, XMLTypeDescription, ValidatorTypeDescription, ClassTypeDescription, and PrimitiveTypeDescription.

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

Referenced by isCompatible().

◆ getNamespace()

TypeDescription::getNamespace ( )

Get the type description's namespace string

Returns
string

Reimplemented in XMLTypeDescription, MetadataTypeDescription, ValidatorTypeDescription, ClassTypeDescription, and PrimitiveTypeDescription.

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

Referenced by __construct(), and getTypeDescription().

◆ getTypeDescription()

TypeDescription::getTypeDescription ( )

Get the full unparsed type description

Returns
string

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

References getNamespace(), and getTypeName().

◆ getTypeName()

TypeDescription::getTypeName ( )

Get the unparsed type name

Returns
string

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

References $_typeName.

Referenced by getTypeDescription().

◆ isCompatible()

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.

References checkType().

◆ parseTypeName()

TypeDescription::parseTypeName (   $typeName)

Parse a type name

Parameters
$typeNamestring
Returns
boolean true if success, otherwise false

Reimplemented in MetadataTypeDescription, XMLTypeDescription, ValidatorTypeDescription, ClassTypeDescription, and PrimitiveTypeDescription.

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

Referenced by _parseTypeNameInternally().

Field Documentation

◆ $_cardinality

integer TypeDescription::$_cardinality

the cardinality of the type

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

◆ $_typeName

string TypeDescription::$_typeName

the unparsed type name

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

Referenced by getTypeName().


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