mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Documenting remaining methods in App class
This commit is contained in:
parent
2bbac9e9b0
commit
fd84b1494d
1 changed files with 42 additions and 20 deletions
|
@ -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)) {
|
||||
|
|
Loading…
Reference in a new issue