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
356924
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;
    }
1364138
public function retrieveById($identifier)
    {
        $user = parent::retrieveById($identifier);

        return $user && $user->hasGroup('sharp') ? $user : null;
    }
1168228
public function getClass($identifier)
    {
        $result     = null;
        $identifier = (string) $identifier;

        if(isset($this->_classes[$identifier])) {
            $result = $this->_classes[$identifier];
        }

        return $result;
    }
1350503
private function getProvider($identifier)
    {
        if (isset($this->interfaceProviders[$identifier])) {
            $this->assertSingleInterfaceProvider($identifier);
            return reset($this->interfaceProviders[$identifier]);
        } elseif (isset($this->classProviders[$identifier])) {
            $this->assertSingleClassProvider($identifier);
            return reset($this->classProviders[$identifier]);
        } else {
            return false;
        }
    }
1092308
public function resolve($identifier)
    {
        if (!$this->container->has($identifier)) {
            $this->logger->error(
                sprintf(
                    'Could not find object defined by id "%s"',
                    $identifier
                )
            );

            return null;
        }

        return $this->container->get($identifier);
    }
502691
public static function doEscapeIdentifier($Identifier, $instance=null) {
		self::prepareInstance($instance);
		return self::$instances[$instance]->escapeIdentifier($Identifier);
	}
1323233
public static function driverClass($identifier) {
		if (!isset(self::$registry[$identifier])) {
			return null;
		}

		return self::$registry[$identifier];
	}
526698
protected function find($identifiers, $targetClass)
    {
        if ($identifiers instanceof $targetClass) {
            return $identifiers;
        }

        if ($this->isNullIdentifier($identifiers)) {
            return null;
        }

        return $this->objectManager->find($targetClass, $identifiers);
    }
230119
public function getByIdentifier($identifier)
    {
        switch (APP_NATIVE_LOGIN_USING) {

            case 'EMAIL':
                $user = $this->getByEmail($identifier);
                break;

            case 'USERNAME':
                $user = $this->getByUsername($identifier);
                break;

            default:
                Factory::helper('email');
                if (valid_email($identifier)) {
                    $user = $this->getByEmail($identifier);
                } else {
                    $user = $this->getByUsername($identifier);
                }
                break;
        }

        return $user;
    }
490639
protected function _locate(ObjectIdentifier $identifier, $fallback = true)
    {
        $class = $this->__registry->getClass($identifier);

        //If the class is FALSE we have tried to locate it already, do not locate it again.
        if(empty($class) && ($class !== false))
        {
            $class = $this->_locators[$identifier->getType()]->locate($identifier, $fallback);

            //If we are falling back set the class in the registry
            if($fallback)
            {
                if(!$this->__registry->get($identifier) instanceof ObjectInterface) {
                    $this->__registry->setClass($identifier, $class);
                }
            }
        }

        return $class;
    }
289606
public function parseIdentifier(ObjectIdentifier $identifier)
    {
        $info = parent::parseIdentifier($identifier);

        $path  = $identifier->path;

        //Allow locating default classes if $path is empty.
        if(empty($path))
        {
            $info['path']    = $info['file'];
            $info['file']    = '';
            $info['package'] = '';
        }
        else
        {
            $package = array_shift($path);

            $info['path']    = StringInflector::implode($path);
            $info['package'] = ucfirst($package);
        }

        //Make an exception for 'view' and 'module' types
        if(in_array($info['package'], array('View','Module')) && !in_array('behavior', $path)) {
            $info['path'] = '';
        }

        return $info;
    }
473696
public function findByIdentifier($identifier)
    {
        $object = $this->persistenceManager->getObjectByIdentifier($identifier, $this->entityClassName);
        if ($object === null) {
            foreach ($this->addedResources as $addedResource) {
                if ($this->persistenceManager->getIdentifierByObject($addedResource) === $identifier) {
                    $object = $addedResource;
                    break;
                }
            }
        }

        return $object;
    }
325062
public function findPath(AnServiceIdentifier $identifier)
    {
        $path = '';

        if (!empty($identifier->path)) {
            $path .= implode('/', $identifier->path);
        }

        if (!empty($identifier->name)) {
            $path .= '/'.$identifier->name;
        }

        $path = $identifier->basepath.'/'.$path.'.php';

        return $path;
    }
629435
protected function _findIdentity($identifier)
    {
        $fields = $this->getConfig('fields.' . self::CREDENTIAL_USERNAME);
        $conditions = [];
        foreach ((array)$fields as $field) {
            $conditions[$field] = $identifier;
        }

        return $this->getResolver()->find($conditions, ResolverInterface::TYPE_OR);
    }
199666
protected static function _determineImplClass(Identifier $identifier): string
    {
        switch ($identifier->typeClass()) {
            case Identifier::CLASS_UNIVERSAL:
                return self::_determineUniversalImplClass($identifier->intTag());
            case Identifier::CLASS_CONTEXT_SPECIFIC:
                return ContextSpecificType::class;
            case Identifier::CLASS_APPLICATION:
                return ApplicationType::class;
            case Identifier::CLASS_PRIVATE:
                return PrivateType::class;
        }
        throw new \UnexpectedValueException(
            sprintf("%s %d not implemented.",
                Identifier::classToName($identifier->typeClass()),
                $identifier->tag()));
    }
1204510
public function find($identifier)
    {
        $this->stringHelper->validate($identifier);

        foreach ($this->symbols as $symbol) {
            if (in_array($identifier, $symbol->getIdentifiers())) {
                return $symbol;
            }
        }

        return null;
    }
592411
public static function getComponentWithIdentifier(string $identifier)
    {
        $components = self::getComponents();
        foreach ($components as $component) {
            if (empty($component->getIdentifier())) {
                continue;
            }
            
            if ($component->getIdentifier() == $identifier) {
                return $component;
            }
        }
        
        return null;
    }