Initializes and return an instance of the given class name.

@access public
@param string $className
@return mixed
8678
public function getInstance($className)
    {
        switch ($className) {
            case '\\Zepi\\Web\\General\\Manager\\AssetManager':
                if ($this->assetManager === null) {
                    $this->assetManager = new $className(
                        $this->getDataObjectBackend('assets.data'),
                        $this->framework->getRootDirectory()
                    );
                    $this->assetManager->initializeAssetManager();
                }
                
                return $this->assetManager;
            break;
            
            case '\\Zepi\\Web\\General\\Manager\\AssetCacheManager':
                if ($this->assetCacheManager === null) {
                    // Get the cache backends
                    $path = $this->framework->getRootDirectory() . '/cache/';
                    $fileObjectBackend = new \Zepi\Turbo\Backend\FileObjectBackend($path . 'cachedFiles.data');
                    $fileBackend = new \Zepi\Turbo\Backend\FileBackend($path);
            
                    // CSS helper
                    $cssHelper = new \Zepi\Web\General\Helper\CssHelper($fileBackend);
            
                    // Load the configuration
                    $configurationManager = $this->framework->getInstance('\\Zepi\\Core\\Utils\\Manager\\ConfigurationManager');
                    $minifyAssets = $configurationManager->getSetting('assets.minifyAssets');
                    $combineAssetGroups = $configurationManager->getSetting('assets.combineAssetGroups');
            
                    $this->assetCacheManager = new $className(
                        $this->framework,
                        $this->getInstance('\\Zepi\\Web\\General\\Manager\\AssetManager'),
                        $fileObjectBackend,
                        $fileBackend,
                        $cssHelper,
                        $minifyAssets,
                        $combineAssetGroups
                    );
                    $this->assetCacheManager->initializeAssetCacheManager();
                }
            
                return $this->assetCacheManager;
            break;
            
            case '\\Zepi\\Web\\General\\Manager\\TemplatesManager':
                if ($this->templatesManager === null) {
                    $this->templatesManager = new $className(
                        $this->framework, 
                        $this->getDataObjectBackend('templates.data')
                    );
                    $this->templatesManager->initializeTemplatesManager();
                    
                    // Execute the register renderer event
                    $runtimeManager = $this->framework->getRuntimeManager();
                    $runtimeManager->executeEvent('\\Zepi\\Web\\General\\Event\\RegisterRenderers');
                }
                
                return $this->templatesManager;
            break;
            
            case '\\Zepi\\Web\\General\\Manager\\MenuManager':
            case '\\Zepi\\Web\\General\\Manager\\MetaInformationManager':
                return $this->framework->initiateObject($className, array(), true);
            break;
            
            default: 
                return $this->framework->initiateObject($className);
            break;
        }
    }
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;
    }
1347284
protected function prepareClassReflectionForUsage($className)
    {
        if (!$this->initialized) {
            $this->initialize();
        }
        $className = $this->cleanClassName($className);
        $this->loadOrReflectClassIfNecessary($className);

        return $className;
    }
1332140
function &findClass($className)
    {
        $return = NULL;
        if (isset($this->_classes[$className])) {
            $return =& $this->_classes[$className];
        }

        return $return;
    }
651629
public function newInstance($className)
    {

        // lock the method
        \Mutex::lock($this->mutex);

        // we're not dispatched
        $this->dispatched = false;

        // initialize the data
        $this->className = $className;

        // notify the thread
        $this->notify();

        // wait till we've dispatched the request
        while ($this->dispatched === false) {
            usleep(100);
        }

        // try to load the last created instance
        if (isset($this->instances[$last = sizeof($this->instances) - 1])) {
            $instance = $this->instances[$last];
        } else {
            throw new \Exception('Requested instance can\'t be created');
        }

        // unlock the method
        \Mutex::unlock($this->mutex);

        // return the created instance
        return $instance;
    }
1342728
public static function fromClassName($className): self
    {
        return new self(\sprintf(
            'Exclude class name should be a string, got "%s" instead.',
            \is_object($className) ? \get_class($className) : \gettype($className)
        ));
    }
323859
public function resolve(ClassName $className)
    {
        if ($className->isAbsolute()) {
            return $className;
        } elseif ($className->isShortName()) {
            $usedClass = $this->usedClass($className);
            if (null !== $usedClass) {
                return $usedClass;
            }
        }

        if (null !== $this->namespaceName()) {
            return $this->namespaceName()->join($className);
        }

        return $className->toAbsolute();
    }
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);
   }
670150
public function detect($className)
    {
        if (!empty($this->cachedRoutes[$className])) {
            return $this->cachedRoutes[$className];
        }
        $this->cachedRoutes[$className] = parent::detect($className);

        return $this->cachedRoutes[$className];
    }
614219
private function buildAndCacheFromFactory(string $className)
    {
        $factory  = self::$cachedInstantiators[$className] = $this->buildFactory($className);
        $instance = $factory();

        if ($this->isSafeToClone(new ReflectionClass($instance))) {
            self::$cachedCloneables[$className] = clone $instance;
        }

        return $instance;
    }
911904
public function getElement($className)
    {
        if ($file = $this->findMappingFile($className)) {
            $result = $this->loadMappingFile($file);
            return $result[$className];
        }
        return false;
    }
56347
protected function getObjectByClassname(/*# string */ $classname)
    {
        // mapping exists
        if (isset($this->mappings[$classname])) {
            $classname = $this->mappings[$classname];

            // is it a reference ? #changed
            if (false !== ($ref = $this->isReference($classname))) {
                $classname = $this->getReferenceValue($ref);

                // got a service object
                if (is_object($classname)) {
                    return $classname;
                }
            }
        }

        // try get service by $classname from container
        return $this->delegatedGet($classname);
    }
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;
    }
1341405
public function classname($classname = null)
    {
        if ($classname === null) {
            return $this->classname;
        }

        $this->classname = $classname;
    }
86902
public function isInstanceOf($className)
    {
        $this->doCheck(function ($value) use ($className) {
            $this->throwExceptionIfFalse(
                $value instanceof $className,
                'Failed assertion that %s is an instance of %s', $value, $className
            );
        });

        return $this;
    }
246958
public function create($className)
    {
        $builder = new Builder($className, $this);
        $this->getGuesser()->fill($builder);
        return $builder;
    }
684235
public static function getClassName($className) {
    if (is_object($className)) $className = self::getClass($className);
    
    $c = $className;
    if (mb_strpos($className,'\\') !== FALSE) {
      $p = explode('\\',$className);
      $c = array_pop($p);
    }
    return $c;
  }