Project

General

Profile

« Previous | Next » 

Revision 10

Added by Manuela over 6 years ago

CoreAutoloader::doRegister() regex creation fixed and made translations of namespaces more flexible
initialize:: set namespace translation of 'acp' to ADMIN_DIRECTORY

View differences:

CoreAutoloader.php
31 31
 * @description  xxx
32 32
 */
33 33
//declare(strict_types = 1);
34
declare(encoding = 'UTF-8');
34
//declare(encoding = 'UTF-8');
35 35

  
36 36
namespace bin;
37 37

  
......
87 87
/**
88 88
 * register this autoloader
89 89
 */
90
    public static function doRegister()
90
    public static function doRegister(array $aAdditionalTranslations = null)
91 91
    {
92
        if (!is_null($aAdditionalTranslations)) {
93
            foreach ($aAdditionalTranslations as $sKey=>$sValue) {
94
                self::$aTransNs[$sKey] = $sValue;
95
            }
96
        }
92 97
        self::$sInstallPath = \rtrim(\str_replace('\\', '/', \dirname(__DIR__)), '/').'/';
93 98
        foreach (self::$aTransNs as $sPattern => $sReplacement) {
94
            self::$aPatterns[]     = '@^'.$sPattern.'@su';
95
            self::$aReplacements[] = $sReplacement;
99
            self::$aPatterns[]     = '@^('.$sPattern.'/)@su';
100
            self::$aReplacements[] = $sReplacement.'/';
96 101
        }
97 102
        \spl_autoload_register([__CLASS__, 'autoLoad']);
98 103
    }

Also available in: Unified diff