spunQ_ReflectionTypeParser Class Reference

A typeParser that uses Reflection for extracting type information. More...

Inheritance diagram for spunQ_ReflectionTypeParser:

spunQ_ITypeParser

List of all members.

Public Member Functions

 parseType ($typeName, $fileName)
 Creates a type object out of documentation.
 addMembers (spunQ_LocalUserType $type, $fileName)
 Adds members to a type object.

Static Public Member Functions

static parseDocumentation ($doc)
 Will bring a doc-comment to a usable form.

Protected Member Functions

 verifyMemberOptions (spunQ_LocalUserType $owner, $name, $options)
 Verifies that valid member options are provided.

Private Member Functions

 findClassName ($typeName, $fileName)
 Tries to find the name of the class name of a local type.
 getTypeName ($tags, $typeName)
 Determines the actual name of a type.
 getParentType ($class)
 Retrieves the parent type of a type.

Static Private Member Functions

static append (&$text, &$tags, &$currentTag, &$currentText)
 Will append the current text to the appropriate element.


Detailed Description

A typeParser that uses Reflection for extracting type information.

Although the file is passed as argument to the inherited functions, it is only used to determine the name of the type to be extracted.

Definition at line 20 of file ReflectionTypeParser.class.php.


Member Function Documentation

spunQ_ReflectionTypeParser::addMembers ( spunQ_LocalUserType type,
fileName 
)

Adds members to a type object.

Since it is not possible to parse types and their members in a single step due to possible circular dependencies (a parent has a child, a child has a parent), the members of a type are added after all types have been declared.

Parameters:
$type A type that was created using parseType().
$fileName The file in which the type was defined.
Returns:
spunQ_ITypeParser $this

Implements spunQ_ITypeParser.

Definition at line 54 of file ReflectionTypeParser.class.php.

static spunQ_ReflectionTypeParser::append ( &$  text,
&$  tags,
&$  currentTag,
&$  currentText 
) [static, private]

Will append the current text to the appropriate element.

This function is required by parseDocumentation() and will be called whenever a new line is encountered that starts with @.

Parameters:
$text The text to set if $currentTag is NULL.
$tags The tags to expand with the given text.
$currentTag The tag we're currently appending information to. Can be NULL, which means currentText will be appended to the $text.
$currentText array of lines that will be assembled to form the final text. This variable will be set to the empty array.
Returns:
void No return, but $currentText will be set to the empty array.

Definition at line 156 of file ReflectionTypeParser.class.php.

spunQ_ReflectionTypeParser::findClassName ( typeName,
fileName 
) [private]

Tries to find the name of the class name of a local type.

Parameters:
$typeName Name of the type to search class for.
$fileName The file in which the type was defined.
Returns:
string

Definition at line 127 of file ReflectionTypeParser.class.php.

spunQ_ReflectionTypeParser::getParentType ( class  )  [private]

Retrieves the parent type of a type.

Parameters:
$class A ReflectionClass object describing the class used for the type.
Returns:
spunQ_UserType
Exceptions:
spunQ.FrameworkError If the $class is not an instance of DataObject.

Definition at line 249 of file ReflectionTypeParser.class.php.

spunQ_ReflectionTypeParser::getTypeName ( tags,
typeName 
) [private]

Determines the actual name of a type.

The name of the type is either the name of the class, or a value passed in the documentation tags.

Parameters:
$tags an associative array mapping tag names to their string values.
$typeName The name of the type.
Returns:
string

Definition at line 236 of file ReflectionTypeParser.class.php.

static spunQ_ReflectionTypeParser::parseDocumentation ( doc  )  [static]

Will bring a doc-comment to a usable form.

Parameters:
$doc A doc-comment (a multiline comment starting with /**). Leading stars and whitespaces are stripped from the comment.
Returns:
array Containing 2 elements:
  • The unannotated text
  • Mapping of tags to strings.

Definition at line 179 of file ReflectionTypeParser.class.php.

spunQ_ReflectionTypeParser::parseType ( typeName,
fileName 
)

Creates a type object out of documentation.

Parameters:
$typeName The proposed name for the type. The actual type name can be different, if one is provided in a @name tag in the class documentation.
$fileName File containing the source code for a type. This file must be named X.class.php where X is the name of a class that is declared in this file. The filename can optionally be prepended with the unique name of the module. Example: The file 'Test.class.php' is expected to contain the declaration of the class 'Test'. It might have as well been called 'myModule_Test.class.php', if the class was defined in the myModule module.
Returns:
spunQ.type.Type The type does not have to contain all members of the type. They will be added in a later step using addMembers().
Exceptions:
spunQ_TypeNotFoundException When the parent type was not found.

Implements spunQ_ITypeParser.

Definition at line 25 of file ReflectionTypeParser.class.php.

spunQ_ReflectionTypeParser::verifyMemberOptions ( spunQ_LocalUserType owner,
name,
options 
) [protected]

Verifies that valid member options are provided.

Parameters:
$owner The type the member is a part of.
$name Name of the member.
$options The options to check.
Returns:
spunQ_Type The type of this member.

Definition at line 101 of file ReflectionTypeParser.class.php.


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

Generated on Fri Jul 1 11:12:43 2011 for spunQ3 by  doxygen 1.5.9