public static function findDefaultClass($identifier)
    {
        $strIdentifier = (string) $identifier;

        if (isset(self::$_defaults[$strIdentifier])) {
            $classname = self::$_defaults[$strIdentifier];

            if ($classname === false || class_exists($classname)) {
                return $classname;
            }
        }

        $classbase = 'Lib'.ucfirst($identifier->package).AnInflector::implode($identifier->path);
        $loader = AnService::get('anahita:loader');
        $classname = $classbase.ucfirst($identifier->name);

        if (!class_exists($classname)) {
            $classname = $classbase.'Default';

            if (!class_exists($classname)) {
                $classname = false;
            }
        }

        if ($classname === false) {
            if (isset(self::$_identifiers[$strIdentifier])) {
                $config = self::$_identifiers[$strIdentifier];

                if (isset($config['default'])) {
                    $classes = array_unique($config['default']);
                } else {
                    $classes = get_prefix($config['prefix'], $config['name']);

                    if (isset($config['fallback'])) {
                        $classes[] = $config['fallback'];
                    }
                }
                foreach ($classes as $class) {
                    //make sure to find  path first
                    //then try to load it
                    if ($loader->findPath($class, $identifier->basepath) &&
                        $loader->loadClass($class, $identifier->basepath)
                           ) {
                        $classname = $class;
                        break;
                    }
                }
            }
        }

        self::setDefaultClass($strIdentifier, $classname);

        return $classname;
    }
public static function findDefaultClass($identifier)
    {
        $strIdentifier = (string) $identifier;

        if (isset(self::$_defaults[$strIdentifier])) {
            $classname = self::$_defaults[$strIdentifier];

            if ($classname === false || class_exists($classname)) {
                return $classname;
            }
        }

        $classbase = 'Lib'.ucfirst($identifier->package).AnInflector::implode($identifier->path);
        $loader = AnService::get('anahita:loader');
        $classname = $classbase.ucfirst($identifier->name);

        if (!class_exists($classname)) {
            $classname = $classbase.'Default';

            if (!class_exists($classname)) {
                $classname = false;
            }
        }

        if ($classname === false) {
            if (isset(self::$_identifiers[$strIdentifier])) {
                $config = self::$_identifiers[$strIdentifier];

                if (isset($config['default'])) {
                    $classes = array_unique($config['default']);
                } else {
                    $classes = get_prefix($config['prefix'], $config['name']);

                    if (isset($config['fallback'])) {
                        $classes[] = $config['fallback'];
                    }
                }
                foreach ($classes as $class) {
                    //make sure to find  path first
                    //then try to load it
                    if ($loader->findPath($class, $identifier->basepath) &&
                        $loader->loadClass($class, $identifier->basepath)
                           ) {
                        $classname = $class;
                        break;
                    }
                }
            }
        }

        self::setDefaultClass($strIdentifier, $classname);

        return $classname;
    }
public static function findDefaultClass ( $ identifier ) { $ strIdentifier = ( string ) $ identifier ; if ( isset ( self :: $ _defaults [ $ strIdentifier ] ) ) { $ classname = self :: $ _defaults [ $ strIdentifier ] ; if ( $ classname === false || class_exists ( $ classname ) ) { return $ classname ; } } $ classbase = 'Lib' . ucfirst ( $ identifier -> package ) . AnInflector :: implode ( $ identifier -> path ) ; $ loader = AnService :: get ( 'anahita:loader' ) ; $ classname = $ classbase . ucfirst ( $ identifier -> name ) ; if ( ! class_exists ( $ classname ) ) { $ classname = $ classbase . 'Default' ; if ( ! class_exists ( $ classname ) ) { $ classname = false ; } } if ( $ classname === false ) { if ( isset ( self :: $ _identifiers [ $ strIdentifier ] ) ) { $ config = self :: $ _identifiers [ $ strIdentifier ] ; if ( isset ( $ config [ 'default' ] ) ) { $ classes = array_unique ( $ config [ 'default' ] ) ; } else { $ classes = get_prefix ( $ config [ 'prefix' ] , $ config [ 'name' ] ) ; if ( isset ( $ config [ 'fallback' ] ) ) { $ classes [ ] = $ config [ 'fallback' ] ; } } foreach ( $ classes as $ class ) { //make sure to find  path first //then try to load it if ( $ loader -> findPath ( $ class , $ identifier -> basepath ) && $ loader -> loadClass ( $ class , $ identifier -> basepath ) ) { $ classname = $ class ; break ; } } } } self :: setDefaultClass ( $ strIdentifier , $ classname ) ; return $ classname ; }
Finds the default class for an identifier or return null.

@param AnServiceIdentifier $identifier The identifier of the class

@return string|bool Return the class name or false if not found
Finds the default class for an identifier or return null .