Instanciates the factorable

@param string $factorableClassName

@return FactorableInterface

@throws \Exception
432099
protected function instanciateFactorable(string $factorableClassName)
    {
        $shortcutParser = new ShortcutNotationParser($factorableClassName);
        $bundle = $this->getContainer()->get('kernel')->getBundle($shortcutParser->getBundleName());

        $stackConfiguration = new EntityStackConfiguration($bundle, $shortcutParser->getEntityName());

        $reflectionClass = new \ReflectionClass($stackConfiguration->getRepositoryClass());

        /** @var \Thuata\FrameworkBundle\Repository\AbstractRepository $repository */
        $repository = $reflectionClass->newInstance();

        return $repository;
    }
516371
protected function createClass(string $className)
    {
        if (!class_exists($className)) {
            throw new class("The class $className does not exists") extends Exception implements
                NotFoundExceptionInterface {
            };
        }

        $reflection = new ReflectionClass($className);

        if ($reflection->hasMethod('__construct')) {
            return $reflection->newInstanceArgs($this->arguments);
        }

        return $reflection->newInstance();
    }
662429
private function instantiateComponent($instanceName) {
		if (!isset($this->declaredInstances[$instanceName])) {
			throw new MoufInstanceNotFoundException("The object instance '".$instanceName."' is not defined.", 1, $instanceName);
		}
		try {
			$instanceDefinition = $this->declaredInstances[$instanceName];
	
			if (isset($instanceDefinition['code'])) {
				if (isset($instanceDefinition['error'])) {
					throw new MoufException("The code defining instance '$instanceName' is invalid: ".$instanceDefinition['error']);
				}
				$closures = $this->getClosures();
				$closure = $closures[$instanceName];
				$instance = $closure($this->delegateLookupContainer);
				$this->objectInstances[$instanceName] = $instance;
				return $instance;
			}
			
			$className = $instanceDefinition["class"];
	
			if (isset($instanceDefinition['constructor'])) {
				$constructorParametersArray = $instanceDefinition['constructor'];
				
				$classDescriptor = new \ReflectionClass($className);
				
				$constructorParameters = array();
				foreach ($constructorParametersArray as $key=>$constructorParameterDefinition) {
					$value = $constructorParameterDefinition["value"];
					switch ($constructorParameterDefinition['parametertype']) {
						case "primitive":
							switch ($constructorParameterDefinition["type"]) {
								case "string":
									$constructorParameters[] = $value;
									break;
								case "request":
									$constructorParameters[] = $_REQUEST[$value];
									break;
								case "session":
									$constructorParameters[] = $_SESSION[$value];
									break;
								case "config":
									$constructorParameters[] = constant($value);
									break;
								case "php":
									$closures = $this->getClosures();
									$closure = $closures[$instanceName]['constructor'][$key];
									if ($closure instanceof \Closure) {
										$constructorParameters[] = $closure($this->delegateLookupContainer);
									} else {
										throw new MoufException("Parse error in the callback of '$instanceName' constructor argument '$key': ".$closure);
									}
									break;
								default:
									throw new MoufException("Invalid type '".$constructorParameterDefinition["type"]."' for object instance '$instanceName'.");
							}
							break;
						case "object":
							if (is_array($value)) {
								$tmpArray = array();
								foreach ($value as $keyInstanceName=>$valueInstanceName) {
									if ($valueInstanceName !== null) {
										$tmpArray[$keyInstanceName] = $this->delegateLookupContainer->get($valueInstanceName);
									} else {
										$tmpArray[$keyInstanceName] = null;
									}
								}
								$constructorParameters[] = $tmpArray;
							} else {
								if ($value !== null) {
									$constructorParameters[] = $this->delegateLookupContainer->get($value);
								} else {
									$constructorParameters[] = null;
								}
							}
							break;
						default:	
							throw new MoufException("Unknown parameter type ".$constructorParameterDefinition['parametertype']." for parameter in constructor of instance '".$instanceName."'");
					}
				}
				if (!isset($this->objectInstances[$instanceName])) {
						$object = $classDescriptor->newInstanceArgs($constructorParameters);
				} else {
						$object = $this->objectInstances[$instanceName];
				}
			} else {
				$object = new $className();
			}
			$this->objectInstances[$instanceName] = $object;
			if (isset($instanceDefinition["fieldProperties"])) {
				foreach ($instanceDefinition["fieldProperties"] as $key=>$valueDef) {
					switch ($valueDef["type"]) {
						case "string":
							$object->$key = $valueDef["value"];
							break;
						case "request":
							$object->$key = $_REQUEST[$valueDef["value"]];
							break;
						case "session":
							$object->$key = $_SESSION[$valueDef["value"]];
							break;
						case "config":
							$object->$key = constant($valueDef["value"]);
							break;
						case "php":
							$closures = $this->getClosures();
							$closure = $closures[$instanceName]['fieldProperties'][$key];
							if ($closure instanceof \Closure) {
								$closure = $closure->bindTo($object);
								$object->$key = $closure($this->delegateLookupContainer);
							} else {
								throw new MoufContainerException("Parse error in the callback of '$instanceName' property '$key': ".$closure);
							}
							break;
						default:
							throw new MoufContainerException("Invalid type '".$valueDef["type"]."' for object instance '$instanceName'.");
					}
				}
			}
	
			if (isset($instanceDefinition["setterProperties"])) {
				foreach ($instanceDefinition["setterProperties"] as $key=>$valueDef) {
					//$object->$key($valueDef["value"]);
					switch ($valueDef["type"]) {
						case "string":
							$object->$key($valueDef["value"]);
							break;
						case "request":
							$object->$key($_REQUEST[$valueDef["value"]]);
							break;
						case "session":
							$object->$key($_SESSION[$valueDef["value"]]);
							break;
						case "config":
							$object->$key(constant($valueDef["value"]));
							break;
						case "php":
							$closures = $this->getClosures();
							$closure = $closures[$instanceName]['setterProperties'][$key];
							if ($closure instanceof \Closure) {
								$closure = $closure->bindTo($object);
							} else {
								throw new MoufContainerException("Parse error in the callback of '$instanceName' setter '$key': ".$closure);
							}
							$object->$key($closure($this->delegateLookupContainer));
							break;
						default:
							throw new MoufContainerException("Invalid type '".$valueDef["type"]."' for object instance '$instanceName'.");
					}
				}
			}
	
			if (isset($instanceDefinition["fieldBinds"])) {
				foreach ($instanceDefinition["fieldBinds"] as $key=>$value) {
					if (is_array($value)) {
						$tmpArray = array();
						foreach ($value as $keyInstanceName=>$valueInstanceName) {
							if ($valueInstanceName !== null) {
								$tmpArray[$keyInstanceName] = $this->get($valueInstanceName);
							} else {
								$tmpArray[$keyInstanceName] = null;
							}
						}
						$object->$key = $tmpArray;
					} else {
						$object->$key = $this->get($value);
					}
				}
			}
	
			if (isset($instanceDefinition["setterBinds"])) {
				foreach ($instanceDefinition["setterBinds"] as $key=>$value) {
					if (is_array($value)) {
						$tmpArray = array();
						foreach ($value as $keyInstanceName=>$valueInstanceName) {
							if ($valueInstanceName !== null) {
								$tmpArray[$keyInstanceName] = $this->get($valueInstanceName);
							} else {
								$tmpArray[$keyInstanceName] = null;
							}
						}
						$object->$key($tmpArray);
					} else {
						$object->$key($this->get($value));
					}
				}
			}
		} catch (MoufInstanceNotFoundException $e) {
			throw new MissingDependencyException("The object instance '".$instanceName."' could not be created because it depends on an object in error (".$e->getMissingInstanceName().")", 2, $instanceName, $e);
		}
		return $object;
	}
112534
public static function get($className, $parentClassName = '')
    {
        $className = self::cleanName($className);

        // We store the relationship between class & parent to prevent cyclical references
        if ($parentClassName) {
            self::$relations[$className][$parentClassName] = true;
        }

        // And we check for cyclical references to prevent infinite loops
        if ($parentClassName
            && isset(self::$relations[$parentClassName])
            && isset(self::$relations[$parentClassName][$className])
        ) {
            $message  = "Cyclical dependency found: {$className} depends on {$parentClassName}";
            $message .= " but is itself a dependency of {$parentClassName}.";
            throw new \Parable\DI\Exception($message);
        }

        if (!self::isStored($className)) {
            self::store(self::create($className, $parentClassName));
        }

        return self::$instances[$className];
    }
276019
public function initiateObject($className, $additionalParameters = array(), $shared = false)
    {
        return $this->dependencyInjectionManager->initiateObject($className, $additionalParameters, $shared);
    }
461238
public static function getInstance($className = '')
    {
        if ($className !== '') {
            try {
                $ref = new \ReflectionClass($className);
                if ($ref->isSubclassOf('\MehrAlsNix\Notifier\Notification')) {
                    self::$instance = $ref->newInstance();
                }
            } catch (\ReflectionException $re) {
                throw new \RuntimeException($re->getMessage());
            }
        } elseif (!self::$instance instanceof Notification) {
            self::$instance = self::fetch();
        }

        return self::$instance;
    }
1172151
public function asSharedInstanceOf($className)
    {
        $endPoint = &$this->getEndPoint();
        $endPoint['lookupType'] = self::TYPE_SHARED;
        $endPoint['className'] = $className;

        return $this;
    }
1194860
public function singleton($className) {
        $closure = function(ContainerInterface $container) use($className) {
            static $instance;
            
            if (is_null($instance)) {
                $instance = $container->make($className);
            }

            return $instance;
        };

        $this->bind($className, $closure);
    }
1162280
protected function instanciateFactorable(string $factorableClassName)
    {
        if (class_exists($factorableClassName)) {
            $service = parent::instanciateFactorable($factorableClassName);
        } elseif ($this->getContainer()->has($factorableClassName)) {
            $service = $this->getContainer()->get($factorableClassName);
        } else {
            throw new ServiceNotFoundException($factorableClassName);
        }

        return $service;
    }
1296869
public function get($className)
    {
        if (!$this->has($className)) {
            throw new Exception('Repository ' . $className . ' not found');
        }
        return $this->pool[$className];
    }
5831
public function createNew($className)
    {
        $constructArguments = func_get_args();
        $object = $this->_createNew( ...$constructArguments);
        
        $traits = class_uses($object);

        if (isset($traits[Framework::class]) == true) {
            $object->setContainer($this->container);
        }

        return $object;
    }
201180
public function named(string $className): self
    {
        if ($this->isFinalized) {
            throw new FinalizedMockException();
        }

        if ('' !== $className) {
            if (
                !preg_match('/^' . static::SYMBOL_PATTERN . '$/S', $className)
            ) {
                throw new InvalidClassNameException($className);
            }
        }

        $this->className = $className;

        return $this;
    }
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;
    }
829146
public function initiateObject($className, $additionalParameters = array(), $shared = false)
    {
        if (isset($this->sharedInstances[$className])) {
            return $this->sharedInstances[$className];
        }
        
        $reflection = new ReflectionClass($className);
        
        if ($reflection->hasMethod('__construct')) {
            $constructor = $reflection->getConstructor();
            $parameters = $this->prepareParameters($constructor, $additionalParameters);
            
            $instance = $reflection->newInstanceArgs($parameters);
        } else {
            $instance = new $className();
        }
        
        if ($shared) {
            $this->sharedInstances[$className] = $instance;
        }
        
        return $instance;
    }
370211
protected static function getInstanceByClassName(string $className, string $fileName)
    {
        if (class_exists($className)) {
            $interface = '\Crossjoin\Browscap\Parser\Sqlite\Adapter\AdapterFactoryInterface';
            $interfaces = class_implements($className);
            if (array_key_exists(ltrim($interface, '\\'), $interfaces)) {
                try {
                    return new $className($fileName);
                } catch (BrowscapException $e) {
                    // Ignore exception, because we just return NULL on failure
                }
            } else {
                throw new UnexpectedValueException(
                    "Class '$className' has to implement the interface '$interface'.",
                    1459000689
                );
            }
        } else {
            throw new UnexpectedValueException("Class '$className' doesn't exist.", 1459000690);
        }

        return null;
    }
246958
public function create($className)
    {
        $builder = new Builder($className, $this);
        $this->getGuesser()->fill($builder);
        return $builder;
    }
1071361
public function createClassConstant(string $className, string $constantName): ClassConstFetch
    {
        $classNameNode = in_array($className, ['static', 'parent', 'self'], true) ? new Name(
            $className
        ) : new FullyQualified($className);

        $classConstFetchNode = $this->builderFactory->classConstFetch($classNameNode, $constantName);
        $classConstFetchNode->class->setAttribute(AttributeKey::RESOLVED_NAME, $classNameNode);

        return $classConstFetchNode;
    }