This is the class that receives the request and forwards it to the right IsmoState class.
You can subclass from this class if you want change the way the state classes are determined and found.
Additional documentation is available in the IsmoWiki at http://ismo.sourceforge.net/wiki/IsmoApplication
Located in /Application.php (line 61)
A temporary place to store a configuration container, until it's passed the the state.
The default state.
The registered filters to call before processing a request.
The logger class used.
By default the IsmoNullLogger is used and as can be guessed from it's name it's not logging anything. The logger class used can be changed with the setLogger() method.
This is an optional callback function (any callback PHP supports) called when a requested state can't be found.
The application's name.
The IsmoRequest instance that represents this request.
The state loader to use.
The state loader is the class that loads and makes instances of the state classes.
Example of state loaders are Ismo_Core_Loaders_FileSystem and Ismo_Core_Loaders_IncludePath.
The URL style to use when determining the state and action and also when generating new URLs.
The constructor.
Handles the request by executing the right action method.
Registers a filter.
Before a request is processed and handed down to the state that will take care of it, the filter() method on all the registered filter class instances are called. It's given the request URI and the filter class can then decided if this request is allowed or not.
If a filter class returns true when its filter() method is called, it is assumed that the filter class has handled the request (usually be forwarding somewhere, e.g. a login page). If the method returns false the next filter class's filter() method is called.
This continues until all the registered filter classes have been processed. If all method calls returned false the state is deduced and the execution given to it.
Set the configuration to pass to the state instance.
You can use this method to pass any global configuration parameters to the dispatched state.
This sets the application's default state.
Example:
- $a = new MyApplication();
- $a->setDefaultState('default');
This sets the log class being used.
If you're making your own class it should implement the PEAR package Log's Log interface but it might be easier to just use one of the the Log package's ready implementations.
Example:
- $app = new Ismo_Core_Application('foo');
- $log =& new Log_file('log.txt', 'identity text');
- $app->setLogger($log);
Set a callback function for missing state errors.
Use this method to set a callback function to be called when a requested state can't be found.
This sets the request class instance to use.
This sets the loader class to use.
The state loader is the class that loads and makes instances of the state classes.
Example of state loaders are Ismo_Core_Loaders_FileSystem and Ismo_Core_Loaders_IncludePath.
Example:
- $loader = new Ismo_Core_Loaders_FileSystem();
- $loader->setStatePath('./states');
- $app = new Ismo_Core_Application('MyCoolName');
- $app->setStateLoader($loader);
Controls which kind of URL style that will be used.
IsmoCore currently supports two kind of styles. The normal query parameter based one, i.e. http://foo.bar?state=thaState&action=theAction and the path-info parameter based on, which looks like http://foo.bar/theState/theAction.
By default the query parameter based style is used, but that can be changed using this method.
The style setting determines how the state and action is identified and it also affects the created URL:s.
Figures out the state.
Tries to figure out what the current state is and if it can't uses the "default" state. You might want to override this method if you want change how the current state is decided.
Dispatches the request to the right state class.
Tries to find a file named <state name>.php in the current directory. If one is found it is included and an instance of a class named <state name> is created. If the instance was created sucessfully the execute method of that instance is called and that method calls the perform method.
If something fails the stateMissing method is called.
Initializes the class.
Sets the _request and _logger attributes if they are not already set.
This makes it easier to unit test this class.
Missing state handler.
This method is called whenever a state is requested which doesn't have a matching state-class or when an error happened when the state was included or the instance created.
If an appropriate callback function is set it's called, otherwise a regular HTTP 404 error is thrown.
Documentation generated on Mon, 14 Jun 2004 11:59:12 +0200 by phpDocumentor 1.3.0RC3