Documenting remaining methods in App class

This commit is contained in:
Jose Lorenzo Rodriguez 2011-03-12 01:15:56 -04:30
parent 2bbac9e9b0
commit fd84b1494d

View file

@ -372,14 +372,15 @@ class App {
*
* `App::objects('plugin');` returns `array('DebugKit', 'Blog', 'User');`
*
* `App::objects('Controller');` returns `array('PagesController', 'BlogController');`
*
* You can also search only within a plugin's objects by using the plugin dot
* syntax.
*
* `App::objects('MyPlugin.Model');` returns `array('MyPluginPost', 'MyPluginComment');`
*
* @param string $type Type of object, i.e. 'model', 'controller', 'helper', or 'plugin'
* @param mixed $path Optional Scan only the path given. If null, paths for the chosen
* type will be used.
* @param string $type Type of object, i.e. 'Model', 'Controller', 'View/Helper', 'file', 'class' or 'plugin'
* @param mixed $path Optional Scan only the path given. If null, paths for the chosen type will be used.
* @param boolean $cache Set to false to rescan objects of the chosen type. Defaults to true.
* @return mixed Either false on incorrect / miss. Or an array of found objects.
*/
@ -475,10 +476,31 @@ class App {
self::$__objects[$cacheLocation][$type] = $values;
}
/**
* Declares a package for a class. This package location will be used
* by the automatic class loader if the class is tried to be used
*
* Usage:
*
* `App::use('MyCustomController', 'Controller');` will setup the class to be found under Controller package
*
* `App::use('MyHelper', 'MyPlugin.View/Helper');` will setup the helper class to be found in plugin's helper package
*
* @param string $className the name of the class to configure package for
* @param string $location the package name
*/
public static function uses($className, $location) {
self::$__classMap[$className] = $location;
}
/**
* Method to handle the automatic class loading. It will look for each class' package
* defined using App::uses() and with this information it will resolve the package name to a full path
* to load the class from. File name for each class should follow the class name. For instance,
* if a class is name `MyCustomClass` the file name should be `MyCustomClass.php`
*
* @param string $className the name of the class to load
*/
public static function load($className) {
if (isset(self::$__classMap[$className])) {
if ($file = self::__mapped($className)) {