mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-09 04:52:42 +00:00
Adding App::location() method to be able to obtain the defined path for a class
This commit is contained in:
parent
273125d2f5
commit
f8ab1d3c73
2 changed files with 23 additions and 0 deletions
|
@ -587,6 +587,19 @@ class App {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the package name where a class was defined to be located at
|
||||
*
|
||||
* @param string $className name of the class to obtain the package name from
|
||||
* @return string package name or null if not declared
|
||||
*/
|
||||
public static function location($className) {
|
||||
if (!empty(self::$__classMap[$className])) {
|
||||
return self::$__classMap[$className];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds classes based on $name or specific file(s) to search. Calling App::import() will
|
||||
* not construct any classes contained in the files. It will only find and require() the file.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue