spunQ_Module Class Reference

A module to the spunQ framework. More...

List of all members.

Public Member Functions

 getFolder ($folder=NULL)
 Gets the folder the module is residing in or another one therein.
 getName ()
 Gets the name of this module.
 getDependencies ()
 Dependencies of this module.
 getAuthors ()
 Gets the authors of this module.
 getLicense ()
 Gets the license of the module.
 getVersion ()
 Gets the version number of the module.
 getWebLink ()
 Gets the link to the web page for this module.
 getSourceFolder ()
 Gets this modules source folder.
 getPageFolder ()
 Gets this modules pages folder.
 getTemplateFolder ()
 Gets this modules templates folder.
 getLanguageFolder ()
 Gets this modules language folder.
 init ()
 Initializes the module.
 getPageFiles (&$newest)
 Returns page files of this module.
 getTemplateFiles (&$newest, $suffixes= 'tpl')
 Provides template files of this module.
 getPagePrefix ($returnUrlPrefix=false)
 Returns the configured page prefix for the module.

Static Public Member Functions

static get ($name, $throwException=true)
 Get the module with give name.
static getFolderNameForExtension ($extension)
static getForAlias ($alias, $throwException=true)
 Gets the module that contains a file with given alias.
static getLanguageFolders ($alias, $throwException=true)
static aliasToTplFile ($alias, $throwException=true)
static aliasToCssFile ($alias, $throwException=true)
static aliasToJsFile ($alias, $throwException=true)
static fileToAlias ($file)
static getAll ()
 Gets all modules mapped by their name.
static getAllCallback ()
 Callback for getAll(), does the job without using the cache.
static assureIsModuleFolder (spunQ_Folder $folder)
 Assures that a folder is a valid module folder.
static parseDocComment (spunQ_File $file)
 Parses the first doc comment in the file.
static parseDocCommentCallback ($file)
 Callback for parseDocComment().
static aliasToTemplateFilesRecursive ($alias, $extension, $throwException=true)
static aliasToFile ($alias, $extension= 'tpl', $throwException=true)
static versionsCompatible ($expected, $actual)
 Checks if an actual version string matches the required version.

Protected Member Functions

 __construct ()
 Constructor.
 checkDependencies ()

Static Protected Member Functions

static createFromDocComment ($folder, $doc)
 Creates an object from a valid module folder and its index' doc comment.

Protected Attributes

 $folder
 The folder the module is residing in.
 $name
 The name of this module.
 $dependencies = array()
 Dependencies of this module.
 $authors
 The authors of this module.
 $license
 The license of the module.
 $version
 The version number of the module.
 $webLink
 A link to a web page to get the module from.

Static Private Member Functions

static getCache ()
 Provides a callback cache to use for various operations.

Static Private Attributes

static $extensionToFolderName
static $fileToAliasCache = array()
static $aliasToTemplateFilesRecursiveCache = array()
 Cache for aliasToTemplateFilesRecursive().
static $cache = NULL
 The cache to use for various operations.


Detailed Description

A module to the spunQ framework.

Todo:
Add the description of a module folder here.

Definition at line 29 of file init/Module.class.php.


Constructor & Destructor Documentation

spunQ_Module::__construct (  )  [protected]

Constructor.

Overridden to reduce visibility.

Definition at line 435 of file init/Module.class.php.


Member Function Documentation

static spunQ_Module::assureIsModuleFolder ( spunQ_Folder folder  )  [static]

Assures that a folder is a valid module folder.

See class docs for the specification of a module folder.

Parameters:
$folder The folder to check.
Returns:
void
Exceptions:
spunQ_ConfigurationError 

Definition at line 191 of file init/Module.class.php.

static spunQ_Module::createFromDocComment ( folder,
doc 
) [static, protected]

Creates an object from a valid module folder and its index' doc comment.

Parameters:
$folder The module's folder
$doc The doc comments of the modules index file as returned by parseDocComment().
Returns:
spunQ_Module
Exceptions:
spunQ_DocumentationError 

Definition at line 325 of file init/Module.class.php.

static spunQ_Module::get ( name,
throwException = true 
) [static]

Get the module with give name.

Parameters:
$name The name of the module
$throwException Whether an exception should be thrown if no module with given name was found. The function will return NULL if this is false and the module was not found.
Returns:
spunQ_Module Or NULL if no such module was found.
Exceptions:
spunQ_UnresolvedAliasException 

Definition at line 40 of file init/Module.class.php.

static spunQ_Module::getAll (  )  [static]

Gets all modules mapped by their name.

Returns:
array Mapping module name to spunQ_Module object.
Todo:
Caching looks broken, removed it for now.

Definition at line 156 of file init/Module.class.php.

static spunQ_Module::getAllCallback (  )  [static]

Callback for getAll(), does the job without using the cache.

Returns:
array Mapping module name to spunQ_Module object.
Exceptions:
spunQ_ConfigurationError 

Definition at line 165 of file init/Module.class.php.

spunQ_Module::getAuthors (  ) 

Gets the authors of this module.

Returns:
array<string>

Definition at line 479 of file init/Module.class.php.

static spunQ_Module::getCache (  )  [static, private]

Provides a callback cache to use for various operations.

Registered operations are 'getAll' and 'parseDocComment' for the according functions.

Returns:
spunQ_ICache

Definition at line 368 of file init/Module.class.php.

spunQ_Module::getDependencies (  ) 

Dependencies of this module.

A list of module names, optionally suffixed with a version number. Examples:

  • spunQ3 1.0
  • strg.user 0.4
  • strg.blog 2.4.3
See versionsCompatible() for the meaning of the version numbers.
Returns:
array<string> A list of module names.

Definition at line 471 of file init/Module.class.php.

spunQ_Module::getFolder ( folder = NULL  ) 

Gets the folder the module is residing in or another one therein.

Parameters:
$folder An optional folder name. Passing this parameter is equivalent to calling $this->getFolder()->getFolder($folder);.
Returns:
spunQ_Folder

Definition at line 445 of file init/Module.class.php.

static spunQ_Module::getForAlias ( alias,
throwException = true 
) [static]

Gets the module that contains a file with given alias.

Tries to find a module whose name is the prefix of the alias.

Parameters:
$alias The alias to find module for.
$throwException Whether the function should throw an exception if no module was found.
Returns:
spunQ_Module Or NULL if $throwException was false.

Definition at line 75 of file init/Module.class.php.

spunQ_Module::getLanguageFolder (  ) 

Gets this modules language folder.

Returns:
spunQ_Folder

Definition at line 535 of file init/Module.class.php.

spunQ_Module::getLicense (  ) 

Gets the license of the module.

Returns:
string

Definition at line 487 of file init/Module.class.php.

spunQ_Module::getName (  ) 

Gets the name of this module.

Returns:
string

Definition at line 456 of file init/Module.class.php.

spunQ_Module::getPageFiles ( &$  newest  ) 

Returns page files of this module.

Parameters:
$newest The newest page file's timestamp. Useful for caching.
Returns:
array Mapping page names to file paths.

Definition at line 582 of file init/Module.class.php.

spunQ_Module::getPageFolder (  ) 

Gets this modules pages folder.

Returns:
spunQ_Folder

Definition at line 519 of file init/Module.class.php.

spunQ_Module::getPagePrefix ( returnUrlPrefix = false  ) 

Returns the configured page prefix for the module.

Parameters:
$returnUrlPrefix Returns prefix with leading slash to be used in URLs.
Returns:
string

Definition at line 629 of file init/Module.class.php.

spunQ_Module::getSourceFolder (  ) 

Gets this modules source folder.

Returns:
spunQ_Folder

Definition at line 511 of file init/Module.class.php.

spunQ_Module::getTemplateFiles ( &$  newest,
suffixes = 'tpl' 
)

Provides template files of this module.

Parameters:
$newest The newest file's timestamp. Useful for caching.
$suffixes The method can operate on different file types. An array of strings may be provided here, where the string must be either of 'js', 'css' or 'tpl'.
Returns:
array Mapping aliases to file paths.

Definition at line 603 of file init/Module.class.php.

spunQ_Module::getTemplateFolder (  ) 

Gets this modules templates folder.

Returns:
spunQ_Folder

Definition at line 527 of file init/Module.class.php.

spunQ_Module::getVersion (  ) 

Gets the version number of the module.

Returns:
string

Definition at line 495 of file init/Module.class.php.

spunQ_Module::getWebLink (  ) 

Gets the link to the web page for this module.

Returns:
string

Definition at line 503 of file init/Module.class.php.

spunQ_Module::init (  ) 

Initializes the module.

Calls its index file.

Returns:
spunQ_Module $this

Definition at line 569 of file init/Module.class.php.

static spunQ_Module::parseDocComment ( spunQ_File file  )  [static]

Parses the first doc comment in the file.

Parameters:
$file The file to extract and parse doc comment from.
Returns:
array As returned by spunQ_ReflectionTypeParser::parseDocumentation() or NULL if no doc comment block was found.

Definition at line 204 of file init/Module.class.php.

static spunQ_Module::parseDocCommentCallback ( file  )  [static]

Callback for parseDocComment().

See also:
parseDocComment()
Parameters:
$file The file to extract and parse doc comment from.
Returns:
array As returned by spunQ_ReflectionTypeParser::parseDocumentation().

Definition at line 218 of file init/Module.class.php.

static spunQ_Module::versionsCompatible ( expected,
actual 
) [static]

Checks if an actual version string matches the required version.

A version string consists of 3 parts:

  • A Major version number, which is updated only if the API has incompatible changes to an earlier version.
  • A Minor version number, which increments whenever the API changes in a backward-compatible manner.
  • A patch version that is updated on each bug-fix without any change to the API.
Parameters:
$expected The expected version number. Must consist of 1-3 numeric values separated by periods.
$actual The expected version number. Must consist of exactly 3 numeric values separated by periods.
Returns:
boolean Whether the actual version number can meet the requirements of the expected version string.

Definition at line 304 of file init/Module.class.php.


Member Data Documentation

spunQ_Module::$aliasToTemplateFilesRecursiveCache = array() [static, private]

Cache for aliasToTemplateFilesRecursive().

Type:
array

Definition at line 234 of file init/Module.class.php.

spunQ_Module::$authors [protected]

The authors of this module.

Type:
array<string>

Definition at line 411 of file init/Module.class.php.

spunQ_Module::$cache = NULL [static, private]

The cache to use for various operations.

Type:
spunQ_ICache

Definition at line 360 of file init/Module.class.php.

spunQ_Module::$dependencies = array() [protected]

Dependencies of this module.

A list of module names, optionally suffixed with a version number. Examples:

  • spunQ3 1.0
  • strg.user 0.4
  • strg.blog 2.4.3
See versionsCompatible() for the meaning of the version numbers.
Type:
array<string>

Definition at line 405 of file init/Module.class.php.

spunQ_Module::$extensionToFolderName [static, private]

Initial value:

 array(
        'js' => 'tpl',
        'tpl' => 'tpl',
        'css' => 'tpl',
        'form' => 'form',
        'page' => 'page',
        'php' => 'src',
    )

Definition at line 51 of file init/Module.class.php.

spunQ_Module::$folder [protected]

The folder the module is residing in.

Type:
spunQ_Folder

Definition at line 386 of file init/Module.class.php.

spunQ_Module::$license [protected]

The license of the module.

Type:
string

Definition at line 417 of file init/Module.class.php.

spunQ_Module::$name [protected]

The name of this module.

Type:
string

Definition at line 392 of file init/Module.class.php.

spunQ_Module::$version [protected]

The version number of the module.

Type:
string

Definition at line 423 of file init/Module.class.php.

spunQ_Module::$webLink [protected]

A link to a web page to get the module from.

Type:
string

Definition at line 429 of file init/Module.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