print mvcControllerMap

Holds the located controller info from the mapper; including the matched controller and the controller path. getController() returns the matched controller; getControllerLevel() returns at what "level" this was matched; and the path is held in getControllerPath()

It should be noted that the original structure is still a SimpleXML object. This class provides a wrapper around this allowing the SimpleXML to be used as instances rather than multiple copies.

The controller properties can be accessed directly by accessor methods (getName(), getDescription()). If the return would be SimpleXML, it is wrapped in another mvcControllerMap shell making the interface consistent.

$oMapper = mvcControllerMapper::getInstance('/path/to/controllerMap.xml');
$oMap = $oMapper->getController('/the/request/string');

$oMap->getName();
$oMap->getDescription();
$oMap->getUriPath();
$oMap->getFilePath();
if ( $oMap->hasSubControllers() ) {
    foreach ( $oMap->getSubControllers as $oSubMap ) {
         $oSubMap->getName();
    }
}

Methods

public __construct()

Returns new instance of mvcControllerMap

public static factory($oXML, [$inLevel = 0], [$inPath = array()])

Creates a new instance of mvcControllerMap using SimpleXML fragment

Level is the level within the site the SimpleXML object correlates to e.g. 0 is root, 1 would be second level etc. $inPath is an array of SimpleXML objects that make up the path to $oXML.

public getControllerPath()

Return ControllerPath

protected getControllerPathToLevel([$inLevel = 0])

Returns an array of all the elements up to $inLevel; array is SimpleXMLElements

public getControllerAtLevel([$inLevel = 0])

Returns the controller held at $inLevel in the controller path

public addControllerToPath($inPath, [$inLevel = 0])

Adds a path element to the map, $inLevel is the depth that this map corresponds to; 0 = root

public setControllerPath([$inControllerPath = array()])

Set the full path to the controller overwriting the existing data, must be array of SimpleXML elements

public getName()

Return just the controller name

public getDescription()

Returns controller description; returns formatted name if no description

public getPath()

Returns just the path set in the controller XML definition

public getController()

Return SimpleXML controller definition built from the controllerMap.xml

public setController($inController)

Set $_Controller to $inController

public getControllerLevel()

Return ControllerLevel

public setControllerLevel($inControllerLevel)

Set $_ControllerLevel to $inControllerLevel

public hasSubControllers()

Returns true if the current controller has sub-controllers

public getSubControllers()

Returns the sub-controllers for the current controller; if no sub-controllers returns empty array

public getFilePath()

Returns controller path e.g. something/somewhere/doController.class.php

public getUriPath()

Returns the path as seen on the URI i.e. separated with a /

public getPathAsString([$inSeparator = null])

Returns the path as a string using $inSeparator to split the path; path is prefixed with $inSeparator If $inSeparator is null system dir sep is used

public getPathComponents()

Returns the main controllers and descriptions to get to the current controller

<  1  >