Definition at line 35 of file Autoloader.php.
◆ __construct()
Constructor
Registers instance with spl_autoload stack
- Returns
- void
Definition at line 460 of file Autoloader.php.
462 spl_autoload_register(array(__CLASS__,
'autoload'));
463 $this->_internalAutoloader = array($this,
'_autoload');
◆ _autoload()
Internal autoloader implementation
- Parameters
-
- Returns
- bool
Definition at line 472 of file Autoloader.php.
call_user_func($callable, $param)
suppressNotFoundWarnings($flag=null)
$_option $_optionId $class
◆ _getAvailableVersions()
_getAvailableVersions |
( |
|
$path, |
|
|
|
$version |
|
) |
| |
|
protected |
Get available versions for the version type requested
- Parameters
-
string | $path | |
string | $version | |
- Returns
- array
Definition at line 559 of file Autoloader.php.
569 $dirs = glob(
"$path/*", GLOB_ONLYDIR);
570 foreach ((array) $dirs as $dir) {
571 $dirName = substr($dir, strlen(
$path) + 1);
572 if (!preg_match(
'/^(?:ZendFramework-)?(\d+\.\d+\.\d+((a|b|pl|pr|p|rc)\d+)?)(?:-minimal)?$/i', $dirName, $matches)) {
576 $matchedVersion = $matches[1];
579 || ((strlen($matchedVersion) >= $versionLen)
580 && (0 === strpos($matchedVersion,
$version)))
582 $versions[$matchedVersion] = $dir .
'/library';
586 uksort($versions,
'version_compare');
◆ _getVersionPath()
_getVersionPath |
( |
|
$path, |
|
|
|
$version |
|
) |
| |
|
protected |
Retrieve the filesystem path for the requested ZF version
- Parameters
-
string | $path | |
string | $version | |
- Returns
- void
Definition at line 508 of file Autoloader.php.
512 if (
$type ==
'latest') {
517 if (empty($availableVersions)) {
521 $matchedVersion = array_pop($availableVersions);
522 return $matchedVersion;
_getVersionType($version)
_getAvailableVersions($path, $version)
◆ _getVersionType()
_getVersionType |
( |
|
$version | ) |
|
|
protected |
Retrieve the ZF version type
- Parameters
-
- Returns
- string "latest", "major", "minor", or "specific"
- Exceptions
-
Definition at line 532 of file Autoloader.php.
534 if (strtolower(
$version) ==
'latest') {
◆ _setNamespaceAutoloaders()
_setNamespaceAutoloaders |
( |
array |
$autoloaders, |
|
|
|
$namespace = '' |
|
) |
| |
|
protected |
Set autoloaders for a specific namespace
- Parameters
-
array | $autoloaders | |
string | $namespace | |
- Returns
- Zend_Loader_Autoloader
Definition at line 494 of file Autoloader.php.
496 $namespace = (string) $namespace;
497 $this->_namespaceAutoloaders[$namespace] = $autoloaders;
◆ autoload()
static autoload |
( |
|
$class | ) |
|
|
static |
Autoload a class
- Parameters
-
- Returns
- bool
Definition at line 114 of file Autoloader.php.
118 foreach ($self->getClassAutoloaders(
$class) as $autoloader) {
120 if ($autoloader->autoload(
$class)) {
123 }
elseif (is_array($autoloader)) {
127 }
elseif (is_string($autoloader) || is_callable($autoloader)) {
128 if ($autoloader(
$class)) {
elseif(isset( $params[ 'redirect_parent']))
call_user_func($callable, $param)
$_option $_optionId $class
◆ getAutoloaders()
Get attached autoloader implementations
- Returns
- array
Definition at line 180 of file Autoloader.php.
◆ getClassAutoloaders()
getClassAutoloaders |
( |
|
$class | ) |
|
Get autoloaders to use when matching class
Determines if the class matches a registered namespace, and, if so, returns only the autoloaders for that namespace. Otherwise, it returns all non-namespaced autoloaders.
- Parameters
-
- Returns
- array Array of autoloaders to use
Definition at line 327 of file Autoloader.php.
330 $autoloaders = array();
333 foreach (array_keys($this->_namespaceAutoloaders) as $ns) {
337 if (0 === strpos(
$class, $ns)) {
338 if ((
false === $namespace) || (strlen($ns) > strlen($namespace))) {
347 if (0 === strpos(
$class, $ns)) {
356 if (count($autoloadersNonNamespace)) {
357 foreach ($autoloadersNonNamespace as $ns) {
358 $autoloaders[] = $ns;
360 unset($autoloadersNonNamespace);
getRegisteredNamespaces()
getNamespaceAutoloaders($namespace)
$_option $_optionId $class
◆ getDefaultAutoloader()
Retrieve the default autoloader callback
- Returns
- string|array PHP Callback
Definition at line 158 of file Autoloader.php.
◆ getInstance()
◆ getNamespaceAutoloaders()
getNamespaceAutoloaders |
( |
|
$namespace | ) |
|
Return all autoloaders for a given namespace
- Parameters
-
- Returns
- array
Definition at line 191 of file Autoloader.php.
193 $namespace = (string) $namespace;
194 if (!array_key_exists($namespace, $this->_namespaceAutoloaders)) {
197 return $this->_namespaceAutoloaders[$namespace];
◆ getRegisteredNamespaces()
getRegisteredNamespaces |
( |
| ) |
|
Get a list of registered autoload namespaces
- Returns
- array
Definition at line 249 of file Autoloader.php.
251 return array_keys($this->_namespaces);
◆ getZfPath()
◆ isFallbackAutoloader()
Is this instance acting as a fallback autoloader?
- Returns
- bool
Definition at line 312 of file Autoloader.php.
◆ pushAutoloader()
pushAutoloader |
( |
|
$callback, |
|
|
|
$namespace = '' |
|
) |
| |
Append an autoloader to the autoloader stack
- Parameters
-
object | array | string | $callback | PHP callback or Zend_Loader_Autoloader_Interface implementation |
string | array | $namespace | Specific namespace(s) under which to register callback |
- Returns
- Zend_Loader_Autoloader
Definition at line 401 of file Autoloader.php.
404 array_push($autoloaders, $callback);
407 $namespace = (array) $namespace;
408 foreach ($namespace as $ns) {
410 array_push($autoloaders, $callback);
getNamespaceAutoloaders($namespace)
setAutoloaders(array $autoloaders)
_setNamespaceAutoloaders(array $autoloaders, $namespace='')
◆ registerNamespace()
registerNamespace |
( |
|
$namespace | ) |
|
Register a namespace to autoload
- Parameters
-
- Returns
- Zend_Loader_Autoloader
Definition at line 206 of file Autoloader.php.
208 if (is_string($namespace)) {
209 $namespace = (array) $namespace;
210 }
elseif (!is_array($namespace)) {
214 foreach ($namespace as $ns) {
215 if (!isset($this->_namespaces[$ns])) {
216 $this->_namespaces[$ns] =
true;
elseif(isset( $params[ 'redirect_parent']))
◆ removeAutoloader()
removeAutoloader |
( |
|
$callback, |
|
|
|
$namespace = null |
|
) |
| |
Remove an autoloader from the autoloader stack
- Parameters
-
object | array | string | $callback | PHP callback or Zend_Loader_Autoloader_Interface implementation |
null | string | array | $namespace | Specific namespace(s) from which to remove autoloader |
- Returns
- Zend_Loader_Autoloader
Definition at line 424 of file Autoloader.php.
426 if (
null === $namespace) {
428 if (
false !== (
$index = array_search($callback, $autoloaders,
true))) {
429 unset($autoloaders[
$index]);
433 foreach ($this->_namespaceAutoloaders as $ns => $autoloaders) {
434 if (
false !== (
$index = array_search($callback, $autoloaders,
true))) {
435 unset($autoloaders[
$index]);
440 $namespace = (array) $namespace;
441 foreach ($namespace as $ns) {
443 if (
false !== (
$index = array_search($callback, $autoloaders,
true))) {
444 unset($autoloaders[
$index]);
getNamespaceAutoloaders($namespace)
setAutoloaders(array $autoloaders)
_setNamespaceAutoloaders(array $autoloaders, $namespace='')
◆ resetInstance()
Reset the singleton instance
- Returns
- void
Definition at line 103 of file Autoloader.php.
105 self::$_instance =
null;
◆ setAutoloaders()
setAutoloaders |
( |
array |
$autoloaders | ) |
|
◆ setDefaultAutoloader()
setDefaultAutoloader |
( |
|
$callback | ) |
|
Set the default autoloader implementation
- Parameters
-
string | array | $callback | PHP callback |
- Returns
- void
Definition at line 143 of file Autoloader.php.
145 if (!is_callable($callback)) {
149 $this->_defaultAutoloader = $callback;
◆ setFallbackAutoloader()
setFallbackAutoloader |
( |
|
$flag | ) |
|
Indicate whether or not this autoloader should be a fallback autoloader
- Parameters
-
- Returns
- Zend_Loader_Autoloader
Definition at line 301 of file Autoloader.php.
303 $this->_fallbackAutoloader = (bool) $flag;
◆ setZfPath()
setZfPath |
( |
|
$spec, |
|
|
|
$version = 'latest' |
|
) |
| |
Definition at line 254 of file Autoloader.php.
257 if (is_array($spec)) {
258 if (!isset($spec[
'path'])) {
261 $path = $spec[
'path'];
262 if (isset($spec[
'version'])) {
268 set_include_path(implode(PATH_SEPARATOR, array(
_getVersionPath($path, $version)
◆ suppressNotFoundWarnings()
suppressNotFoundWarnings |
( |
|
$flag = null | ) |
|
Get or set the value of the "suppress not found warnings" flag
- Parameters
-
- Returns
- bool|Zend_Loader_Autoloader Returns boolean if no argument is passed, object instance otherwise
Definition at line 286 of file Autoloader.php.
288 if (
null === $flag) {
291 $this->_suppressNotFoundWarnings = (bool) $flag;
$_suppressNotFoundWarnings
◆ unregisterNamespace()
unregisterNamespace |
( |
|
$namespace | ) |
|
Unload a registered autoload namespace
- Parameters
-
- Returns
- Zend_Loader_Autoloader
Definition at line 228 of file Autoloader.php.
230 if (is_string($namespace)) {
231 $namespace = (array) $namespace;
232 }
elseif (!is_array($namespace)) {
236 foreach ($namespace as $ns) {
237 if (isset($this->_namespaces[$ns])) {
238 unset($this->_namespaces[$ns]);
elseif(isset( $params[ 'redirect_parent']))
◆ unshiftAutoloader()
unshiftAutoloader |
( |
|
$callback, |
|
|
|
$namespace = '' |
|
) |
| |
Add an autoloader to the beginning of the stack
- Parameters
-
object | array | string | $callback | PHP callback or Zend_Loader_Autoloader_Interface implementation |
string | array | $namespace | Specific namespace(s) under which to register callback |
- Returns
- Zend_Loader_Autoloader
Definition at line 378 of file Autoloader.php.
381 array_unshift($autoloaders, $callback);
384 $namespace = (array) $namespace;
385 foreach ($namespace as $ns) {
387 array_unshift($autoloaders, $callback);
getNamespaceAutoloaders($namespace)
setAutoloaders(array $autoloaders)
_setNamespaceAutoloaders(array $autoloaders, $namespace='')
◆ $_autoloaders
◆ $_defaultAutoloader
$_defaultAutoloader = array('Zend_Loader', 'loadClass') |
|
protected |
◆ $_fallbackAutoloader
$_fallbackAutoloader = false |
|
protected |
◆ $_instance
◆ $_internalAutoloader
◆ $_namespaceAutoloaders
$_namespaceAutoloaders = array() |
|
protected |
◆ $_namespaces
Initial value:= array(
'Zend_' => true,
'ZendX_' => true,
)
Definition at line 65 of file Autoloader.php.
◆ $_suppressNotFoundWarnings
$_suppressNotFoundWarnings = false |
|
protected |
◆ $_zfPath
The documentation for this class was generated from the following file: