public static function searchAddonClassFileInAddon(string $class, Addon $addon)
    {
        $classWithNamespaceToLoad = str_replace('\\', '/', $class);
        $namespaceToLoad = dirname($classWithNamespaceToLoad);
        
        $classToLoad = basename($classWithNamespaceToLoad);
        $classFileName = $classToLoad . EXT_PHP;
        
        $paths = array();
        
        $paths[] = ($addon->getPath() . $classFileName);
        $paths[] = ($addon->getPath() . $classWithNamespaceToLoad . EXT_PHP);
        $paths[] = ($addon->getPath() . strtolower($namespaceToLoad) . '/' . $classFileName);
        
        $paths[] = ($addon->getPath() . DIR_LIBS_BASENAME . $classFileName);
        $paths[] = ($addon->getPath() . DIR_LIBS_BASENAME . $classWithNamespaceToLoad . EXT_PHP);
        $paths[] = ($addon->getPath() . DIR_LIBS_BASENAME . strtolower($namespaceToLoad) . '/' . $classFileName);
        
        $segments = explode('/', $namespaceToLoad);
        for ($sidx = 1; $sidx <= sizeof($segments); $sidx++) {
            $paths[] = ($addon->getPath() . implode('-', array_slice($segments, 0, $sidx)) . '/' . $classFileName);
            $paths[] = ($addon->getPath() . DIR_LIBS_BASENAME . implode('-', array_slice($segments, 0, $sidx)) . '/' . $classFileName);
        }
        
        foreach ($paths as $path) {
            if (is_file($path)) {
                return $path;
            }
        }
        
        return null;
    }
public static function searchAddonClassFileInAddon(string $class, Addon $addon)
    {
        $classWithNamespaceToLoad = str_replace('\\', '/', $class);
        $namespaceToLoad = dirname($classWithNamespaceToLoad);
        
        $classToLoad = basename($classWithNamespaceToLoad);
        $classFileName = $classToLoad . EXT_PHP;
        
        $paths = array();
        
        $paths[] = ($addon->getPath() . $classFileName);
        $paths[] = ($addon->getPath() . $classWithNamespaceToLoad . EXT_PHP);
        $paths[] = ($addon->getPath() . strtolower($namespaceToLoad) . '/' . $classFileName);
        
        $paths[] = ($addon->getPath() . DIR_LIBS_BASENAME . $classFileName);
        $paths[] = ($addon->getPath() . DIR_LIBS_BASENAME . $classWithNamespaceToLoad . EXT_PHP);
        $paths[] = ($addon->getPath() . DIR_LIBS_BASENAME . strtolower($namespaceToLoad) . '/' . $classFileName);
        
        $segments = explode('/', $namespaceToLoad);
        for ($sidx = 1; $sidx <= sizeof($segments); $sidx++) {
            $paths[] = ($addon->getPath() . implode('-', array_slice($segments, 0, $sidx)) . '/' . $classFileName);
            $paths[] = ($addon->getPath() . DIR_LIBS_BASENAME . implode('-', array_slice($segments, 0, $sidx)) . '/' . $classFileName);
        }
        
        foreach ($paths as $path) {
            if (is_file($path)) {
                return $path;
            }
        }
        
        return null;
    }
public static function searchAddonClassFileInAddon ( string $ class , Addon $ addon ) { $ classWithNamespaceToLoad = str_replace ( '\\' , '/' , $ class ) ; $ namespaceToLoad = dirname ( $ classWithNamespaceToLoad ) ; $ classToLoad = basename ( $ classWithNamespaceToLoad ) ; $ classFileName = $ classToLoad . EXT_PHP ; $ paths = array ( ) ; $ paths [ ] = ( $ addon -> getPath ( ) . $ classFileName ) ; $ paths [ ] = ( $ addon -> getPath ( ) . $ classWithNamespaceToLoad . EXT_PHP ) ; $ paths [ ] = ( $ addon -> getPath ( ) . strtolower ( $ namespaceToLoad ) . '/' . $ classFileName ) ; $ paths [ ] = ( $ addon -> getPath ( ) . DIR_LIBS_BASENAME . $ classFileName ) ; $ paths [ ] = ( $ addon -> getPath ( ) . DIR_LIBS_BASENAME . $ classWithNamespaceToLoad . EXT_PHP ) ; $ paths [ ] = ( $ addon -> getPath ( ) . DIR_LIBS_BASENAME . strtolower ( $ namespaceToLoad ) . '/' . $ classFileName ) ; $ segments = explode ( '/' , $ namespaceToLoad ) ; for ( $ sidx = 1 ; $ sidx <= sizeof ( $ segments ) ; $ sidx ++ ) { $ paths [ ] = ( $ addon -> getPath ( ) . implode ( '-' , array_slice ( $ segments , 0 , $ sidx ) ) . '/' . $ classFileName ) ; $ paths [ ] = ( $ addon -> getPath ( ) . DIR_LIBS_BASENAME . implode ( '-' , array_slice ( $ segments , 0 , $ sidx ) ) . '/' . $ classFileName ) ; } foreach ( $ paths as $ path ) { if ( is_file ( $ path ) ) { return $ path ; } } return null ; }
Try to find the file for the given classname in the given addon.
Supports PSR-0 and PSR-4 with a somewhat custom implementation.

@param string $class
Class to find the file of.

@param Addon $addon
Addon to search for the class.

@return string The file for the given classname if found in the given addon.
Try to find the file for the given classname in the given addon . Supports PSR - 0 and PSR - 4 with a somewhat custom implementation .