Initializes and return an instance of the given class name.

@access public
@param string $className
@return mixed
328410
public function getInstance($className)
    {
        switch ($className) {
            case '\\Zepi\\Api\\Rest\\Helper\\FrontendHelper':
                if ($this->frontendHelper === null) {
                    $this->frontendHelper = $this->framework->initiateObject($className);
                }
            
                return $this->frontendHelper;
            break;

            default: 
                return $this->framework->initiateObject($className);
            break;
        }
    }
1016716
public function find($className)
    {
        if (empty($className)) {
            return BaseMock::class;
        }

        /** @var ClassReflection[] $result */
        $result = [];
        foreach ($this->_classes as $class) {
            if ($class->matchClassName($className)) {
                $result[] = $class;
            }
        }
        $result = SortUtils::sortReflections($result);

        if (count($result)) {
            return $result[0]->getName();
        }
        return BaseMock::class;
    }
925102
public static function instance( $className = null )
    {
        if ( is_null( $className ) )
        {
            $ini = eZINI::instance( 'ezcomments.ini' );
            $className = $ini->variable( 'NotificationSettings', 'NotificationManagerClass' );
        }
        if ( !isset( self::$instance ) )
        {
            self::$instance = new $className();
        }
        return self::$instance;
    }
1341405
public function classname($classname = null)
    {
        if ($classname === null) {
            return $this->classname;
        }

        $this->classname = $classname;
    }
981333
protected function getInstance($classname, $params)
    {
        $components = UIComponentsRegistry::get('ui-components');
        if (is_null($components)) {
            return false;
        }
        $object = $components->first(function ($value, $key) use($classname) {
            return $value instanceof $classname;
        });
        if (!$object) {
            return false;
        }

        $attributes       = array_only(array_get($params, 'data'), ['x', 'y', 'width', 'height', 'disabled', 'id']);
        $attributes['id'] = isset($params['id']) ? $params['id'] : null;

        $object->setAttributes($attributes);
        return $object;
    }
396689
public function load($className) {
        //如果内存缓存里有
        if (isset($this->metadataMap[$className])) {
            return $this->metadataMap[$className];
        }

        //如果没有就加载
        $classMetadata = $this->doLoad($className);

        //存入内存缓存
        $this->metadataMap[$className] = $classMetadata;

        return $classMetadata;
    }
405715
public static function getClassProfile($classname) {
		if (!is_string($classname) || empty($classname)) {
			throw new \InvalidArgumentException("Argument is not a valid class name");
		}
		
		//check if is already stored
		if (array_key_exists($classname, self::$profiles)) {
			return self::$profiles[$classname];
		}
		
		//validate classname
 		if (!class_exists($classname, true)) {
 			throw new \RuntimeException("Class %s could not be found");
 		}
		
		//build profile and return
		self::$profiles[$classname] = new ClassProfile($classname);
		return self::$profiles[$classname];
	}
849649
public function getClassByName($className)
    {
        $classMap = $this->getClassMap($this->splitClassName($className)) . "[\"__class\"]";
        $return = null;

        eval(
            "if (isset(\$this->indexedClasses$classMap)) {"
            . " \$return = \$this->indexedClasses$classMap;"
            . "}"
        );

        return $return;
    }
1347284
protected function prepareClassReflectionForUsage($className)
    {
        if (!$this->initialized) {
            $this->initialize();
        }
        $className = $this->cleanClassName($className);
        $this->loadOrReflectClassIfNecessary($className);

        return $className;
    }
369549
public function findClassName($className)
    {
        if (!empty($this->lookupCache->classes[$className])) {
            return $this->lookupCache->classes[$className];
        }

        if (class_exists($className)) return $className;
        $startsWithSlash = ($className[0] == '\\');

        foreach ($this->searchOrder as $namespace)
        {
            $testClass = '\\' . $namespace;
            if (!$startsWithSlash) {
                $testClass .= '\\';
            }

            $testClass .= $className;

            if (class_exists($testClass)) {
                $this->lookupCache->classes[$className] = $testClass;
                return $testClass;
            }
        }

        return null;
    }
655931
public final function get($className)
   {
       try {
           return $this->cache->get(... func_get_args());
       } catch (NotFoundException $e) {
           try {
               $service = $this->resolver->resolve($className, $this->cache);
           } catch (NotFoundException $e) {
               throw $e;
           } catch (ContainerException $e) {
               throw $e;
           }
       }
       $this->cache->set($className, $service);
       return $this->cache->get($className);
   }
1177301
public static function getAttributesFor($className)
    {
        if (!self::attributesSetFor($className)) {
            # Force initialize.
            $className::getAttributeSet();
        }
        return self::$classAttributes[$className];
    }
1320788
public static function instantiate($className)
    {
        $objectManager = self::get()->getObjectManager();
        $args = func_get_args();

        if (1 === count($args)) {
            return $objectManager->get($className);
        }

        return call_user_func_array([$objectManager, 'get'], $args);
    }
1187639
public function getElements($className = ''){

        $returnValue = array();

        if($className){
            foreach($this->elements as $serial => $element){
                if($element instanceof $className){
                    $returnValue[$serial] = $element;
                }
            }
        }else{
            $returnValue = $this->elements;
        }


        return $returnValue;
    }
763639
public function makeInstance($className)
    {
        // class reflection
        $reflection = new ReflectionClass($className);
        // get the class constructor
        $constructor = $reflection->getConstructor();

        // if there is no constructor, just create and
        // return a new instance
        if (!$constructor) {
            return $reflection->newInstance();
        }

        // created and returns the new instance passing the
        // resolved parameters
        return $reflection->newInstanceArgs($this->resolveParameters($constructor->getParameters(), []));
    }
1369953
public function getInstance($className)
    {
        switch ($className) {
            case '\\Zepi\\Core\\AccessControl\\Manager\\AccessControlManager':
                if ($this->accessControlManager === null) {
                    $dataSourceManager = $this->framework->getDataSourceManager();
                    
                    $this->accessControlManager = $this->framework->initiateObject($className, array(
                        'accessEntitiesDataSource' => $dataSourceManager->getDataSource('\\Zepi\\Core\\AccessControl\\DataSource\\AccessEntitiesDataSourceInterface'),
                        'permissionsDataSource' => $dataSourceManager->getDataSource('\\Zepi\\Core\\AccessControl\\DataSource\\PermissionsDataSourceInterface')
                    ));
                }
                
                return $this->accessControlManager;
            break;
            
            case '\\Zepi\\Core\\AccessControl\\Manager\\AccessLevelManager':
                if ($this->accessLevelManager === null) {
                    $accessLevelsObjectBackend = $this->framework->initiateObject('\Zepi\Turbo\Backend\FileObjectBackend', array(
                        'path' => $this->framework->getRootDirectory() . '/data/access-levels.data'
                    ));
                    
                    $this->accessLevelManager = $this->framework->initiateObject($className, array(
                        'accessLevelObjectBackend' => $accessLevelsObjectBackend
                    ));
                    $this->accessLevelManager->initializeAccessLevelManager();
                }
            
                return $this->accessLevelManager;
            break;
            
            case '\\Zepi\\Core\\AccessControl\\Manager\\EventAccessManager':
                if ($this->eventAccessManager === null) {
                    $eventAccessObjectBackend = $this->framework->initiateObject('\Zepi\Turbo\Backend\FileObjectBackend', array(
                        'path' => $this->framework->getRootDirectory() . '/data/event-access-levels.data'
                    ));
            
                    $this->eventAccessManager = $this->framework->initiateObject($className, array(
                        'eventAccessObjectBackend' => $eventAccessObjectBackend
                    ));
                    $this->eventAccessManager->initializeEventAccessManager();
                }
            
                return $this->eventAccessManager;
            break;
            
            case '\\Zepi\\Core\\AccessControl\\DataSource\\AccessEntitiesDataSourceDoctrine':
                $dataSourceManager = $this->framework->getDataSourceManager();
                
                return $this->framework->initiateObject($className, array(
                    'permissionsDataSource' => $dataSourceManager->getDataSource('\\Zepi\\Core\\AccessControl\\DataSource\\PermissionsDataSourceInterface')
                ));
            break;
            
            default: 
                return $this->framework->initiateObject($className);
            break;
        }
    }
81566
public function create(string $className)
    {
        if (array_key_exists($className, $this->cache)) {
            return $this->cache[$className];
        }

        if (!class_exists($className)) {
            throw new RuntimeException("Mapper not found. Attempted to load '{$className}'.");
        }

        $instance = new $className($this->connection, $this->table);
        $this->cache[$className] = $instance;

        return $instance;
    }