src/core/framework/core/3rdparty/ezcomponents/Base/src/base.php
public static function addClassRepository( $basePath, $autoloadDirPath = null, $prefix = null )
    {
        // check if base path exists
        if ( !is_dir( $basePath ) )
        {
            throw new ezcBaseFileNotFoundException( $basePath, 'base directory' );
        }

        // calculate autoload path if it wasn't given
        if ( is_null( $autoloadDirPath ) )
        {
            $autoloadDirPath = $basePath . '/autoload';
        }

        // check if autoload dir exists
        if ( !is_dir( $autoloadDirPath ) )
        {
            throw new ezcBaseFileNotFoundException( $autoloadDirPath, 'autoload directory' );
        }

        // add info to $repositoryDirs
        if ( $prefix === null )
        {
            $array = array( 'basePath' => $basePath, 'autoloadDirPath' => $autoloadDirPath );

            // add info to the list of extra dirs
            ezcBase::$repositoryDirs[] = $array;
        }
        else
        {
            if ( array_key_exists( $prefix, ezcBase::$repositoryDirs ) )
            {
                throw new ezcBaseDoubleClassRepositoryPrefixException( $prefix, $basePath, $autoloadDirPath );
            }

            // add info to the list of extra dirs, and use the prefix to identify the new repository.
            ezcBase::$repositoryDirs[$prefix] = array( 'basePath' => $basePath, 'autoloadDirPath' => $autoloadDirPath );
        }
    }
public static function addClassRepository( $basePath, $autoloadDirPath = null, $prefix = null )
    {
        // check if base path exists
        if ( !is_dir( $basePath ) )
        {
            throw new ezcBaseFileNotFoundException( $basePath, 'base directory' );
        }

        // calculate autoload path if it wasn't given
        if ( is_null( $autoloadDirPath ) )
        {
            $autoloadDirPath = $basePath . '/autoload';
        }

        // check if autoload dir exists
        if ( !is_dir( $autoloadDirPath ) )
        {
            throw new ezcBaseFileNotFoundException( $autoloadDirPath, 'autoload directory' );
        }

        // add info to $repositoryDirs
        if ( $prefix === null )
        {
            $array = array( 'basePath' => $basePath, 'autoloadDirPath' => $autoloadDirPath );

            // add info to the list of extra dirs
            ezcBase::$repositoryDirs[] = $array;
        }
        else
        {
            if ( array_key_exists( $prefix, ezcBase::$repositoryDirs ) )
            {
                throw new ezcBaseDoubleClassRepositoryPrefixException( $prefix, $basePath, $autoloadDirPath );
            }

            // add info to the list of extra dirs, and use the prefix to identify the new repository.
            ezcBase::$repositoryDirs[$prefix] = array( 'basePath' => $basePath, 'autoloadDirPath' => $autoloadDirPath );
        }
    }
public static function addClassRepository ( $ basePath , $ autoloadDirPath = null , $ prefix = null ) { // check if base path exists if ( ! is_dir ( $ basePath ) ) { throw new ezcBaseFileNotFoundException ( $ basePath , 'base directory' ) ; } // calculate autoload path if it wasn't given if ( is_null ( $ autoloadDirPath ) ) { $ autoloadDirPath = $ basePath . '/autoload' ; } // check if autoload dir exists if ( ! is_dir ( $ autoloadDirPath ) ) { throw new ezcBaseFileNotFoundException ( $ autoloadDirPath , 'autoload directory' ) ; } // add info to $repositoryDirs if ( $ prefix === null ) { $ array = array ( 'basePath' => $ basePath , 'autoloadDirPath' => $ autoloadDirPath ) ; // add info to the list of extra dirs ezcBase :: $ repositoryDirs [ ] = $ array ; } else { if ( array_key_exists ( $ prefix , ezcBase :: $ repositoryDirs ) ) { throw new ezcBaseDoubleClassRepositoryPrefixException ( $ prefix , $ basePath , $ autoloadDirPath ) ; } // add info to the list of extra dirs, and use the prefix to identify the new repository. ezcBase :: $ repositoryDirs [ $ prefix ] = array ( 'basePath' => $ basePath , 'autoloadDirPath' => $ autoloadDirPath ) ; } }
Adds an additional class repository.

Used for adding class repositoryies outside the eZ components to be
loaded by the autoload system.

This function takes two arguments: $basePath is the base path for the
whole class repository and $autoloadDirPath the path where autoload
files for this repository are found. The paths in the autoload files are
relative to the package directory as specified by the $basePath
argument. I.e. class definition file will be searched at location
$basePath + path to the class definition file as stored in the autoload
file.

addClassRepository() should be called somewhere in code before external classes
are used.

Example:
Take the following facts:
<ul>
<li>there is a class repository stored in the directory "./repos"</li>
<li>autoload files for that repository are stored in "./repos/autoloads"</li>
<li>there are two components in this repository: "Me" and "You"</li>
<li>the "Me" component has the classes "erMyClass1" and "erMyClass2"</li>
<li>the "You" component has the classes "erYourClass1" and "erYourClass2"</li>
</ul>

In this case you would need to create the following files in
"./repos/autoloads". Please note that the part before _autoload.php in
the filename is the first part of the <b>classname</b>, not considering
the all lower-case letter prefix.

"my_autoload.php":
<code>
<?php
return array (
'erMyClass1' => 'Me/myclass1.php',
'erMyClass2' => 'Me/myclass2.php',
);
?>
</code>

"your_autoload.php":
<code>
<?php
return array (
'erYourClass1' => 'You/yourclass1.php',
'erYourClass2' => 'You/yourclass2.php',
);
?>
</code>

The directory structure for the external repository is then:
<code>
./repos/autoloads/my_autoload.php
./repos/autoloads/you_autoload.php
./repos/Me/myclass1.php
./repos/Me/myclass2.php
./repos/You/yourclass1.php
./repos/You/yourclass2.php
</code>

To use this repository with the autoload mechanism you have to use the
following code:
<code>
<?php
ezcBase::addClassRepository( './repos', './repos/autoloads' );
$myVar = new erMyClass2();
?>
</code>

@throws ezcBaseFileNotFoundException if $autoloadDirPath or $basePath do not exist.
@param string $basePath
@param string $autoloadDirPath
@param string $prefix
Adds an additional class repository .