Make component instance

@param  string $name       Component name
@param  array  $parameters Component parameter
@return mixed
546302
public function make($name, $parameters = []) {
		$name = $this->getAlias($name);

		if (is_string($name) && $this->resolved($name)) {
			return $this->instances[$name];
		}

		if (is_callable($name) || (is_string($name) && !$this->registered($name))) {
			return $this->build($name, $parameters ?: []);
		}

		list($builder, $singleton) = $this->extractComponentBuilder($name);

		$component = $this->build($builder, $parameters);

		if ($this->hasExtender($name)) {
			$extenders = $this->getExtenders($name);
			$component = $this->resolveExtend($component, $extenders);
		}

		if ($singleton) {
			$this->instance($name, $component);
		}

		return $component;
	}
750980
public function create(array $parameters = [])
    {
        if (isset($parameters['cache']) && $parameters['cache'] instanceof Cache) {
            $cache = $parameters['cache'];
        } else {
            $cache = new ApcCache();
        }

        $annotationReaderFactory = new AnnotationReaderFactory();
        $annotationReader = $annotationReaderFactory->create($parameters);

        return new ReflectionService($cache, $annotationReader);

    }
1359097
static public function instance($name=null)
    {
        $options = $name ? ['name' => $name] : [];
        $name = $name ?: get_called_class();
        
        if (!isset(static::$instances[$name])) {
            static::$instances[$name] = new static($name);
        }
        
        return static::$instances[$name];
    }
1344776
protected function renderBlock($name, $parameters)
    {
        /** @var Twig_TemplateInterface $template */
        foreach ($this->getTemplates() as $template) {
            if ($template->hasBlock($name)) {

                $context = array_merge(
                    $template->getEnvironment()->getGlobals(),
                    $parameters
                );

                return $template->renderBlock($name, $context);
            }
        }

        throw new \InvalidArgumentException(sprintf('Block "%s" doesn\'t exist in grid template.', $name));
    }
3731
protected function createComponentDriver($name)
    {
        $config = Arr::get($this->config, "component.{$name}", []);
        $cache  = $this->getCacheRepository($config);
        return $this->createProvider(new Component($name, $config, $this->app, $cache));
    }
155143
public function setParameter($name, $parameter)
  {
    if ($this->isLocked()) {
      return $this->getObj()->setParameter($name, $parameter)->setLocked();
    } else {
      return parent::setParameter($name, $parameter);
    }
  }
1370147
public static function create($parameters)
    {
        if (is_string($parameters)) {
            return self::fromString($parameters);
        }

        if (is_array($parameters)) {
            return self::fromArray($parameters);
        }

        throw new InvalidArgumentException('Invalid parameters type');
    }
942013
protected function _buildInstance($instance, array $parameters = [])
  {
    if(is_scalar($instance) && class_exists($instance))
    {
      return Objects::create($instance, $parameters);
    }
    return $instance;
  }
90366
protected function ruleFactory(string $name, array $parameters): RuleInterface
	{
		return $this->container->get($this->getRuleClassName($name), $parameters);
	}
321581
public static function url(string $name, ?array $parameters = [])
  {
    $url = null;

    foreach (Swish::$routes as $route) {
      if ($route['name'] == $name) {
        $url = $route['pattern'];

        if ($route['required'] > 0 && ($route['required'] == count($parameters))) {
          foreach ($parameters as $name => $parameter) {
            $url = str_replace('{' . $name . '}', $parameter, $url);
          }
        }
      }
    }

    if (str_contains($url, ['{', '}'])) $url = null;

    return $url;
  }
634280
public function create($name, $params = [ ])
    {
        if ($name !== null) {
            $name = $this->getName($name);
        } else {
            $name = $this->_base;
        }

        if (!isset($params['rule'])) {
            $params['rule'] = $this->_rule;
        }

        if (!isset($params['class'])) {
            $params['class'] = $this->_class;
        }

        return $this->link($name, $params);
    }
562396
public function getComponent($name, $need = TRUE)
	{
		if (isset($this->components[$name])) {
			return $this->components[$name];
		}

		if (is_int($name)) {
			$name = (string) $name;

		} elseif (!is_string($name)) {
			throw new Nette\InvalidArgumentException(sprintf('Component name must be integer or string, %s given.', gettype($name)));

		} else {
			$a = strpos($name, self::NAME_SEPARATOR);
			if ($a !== FALSE) {
				$ext = (string) substr($name, $a + 1);
				$name = substr($name, 0, $a);
			}

			if ($name === '') {
				if ($need) {
					throw new Nette\InvalidArgumentException('Component or subcomponent name must not be empty string.');
				}
				return;
			}
		}

		if (!isset($this->components[$name])) {
			$component = $this->createComponent($name);
			if ($component) {
				if (!$component instanceof IComponent) {
					throw new Nette\UnexpectedValueException('Method createComponent() did not return Nette\ComponentModel\IComponent.');

				} elseif (!isset($this->components[$name])) {
					$this->addComponent($component, $name);
				}
			}
		}

		if (isset($this->components[$name])) {
			if (!isset($ext)) {
				return $this->components[$name];

			} elseif ($this->components[$name] instanceof IContainer) {
				return $this->components[$name]->getComponent($ext, $need);

			} elseif ($need) {
				throw new Nette\InvalidArgumentException("Component with name '$name' is not container and cannot have '$ext' component.");
			}

		} elseif ($need) {
			$hint = Nette\Utils\ObjectMixin::getSuggestion(array_merge(
				array_keys($this->components),
				array_map('lcfirst', preg_filter('#^createComponent([A-Z0-9].*)#', '$1', get_class_methods($this)))
			), $name);
			throw new Nette\InvalidArgumentException("Component with name '$name' does not exist" . ($hint ? ", did you mean '$hint'?" : '.'));
		}
	}
468607
public function invoke($type, $parameters = null)
    {
        $class = $this->getClass($type);
        $name  = $this->normalizeType($type);

        $params = func_get_args();
        array_shift($params);

        $reflector = new \ReflectionClass($class);
        $instance  = $reflector->newInstanceArgs($params);

        if (empty($params)) {
            parent::__set($name, $instance);
        }

        return (clone $instance);
    }
37823
public function make($abstract, array $parameters = [])
    {
        if ($this->offsetExists($abstract)) {
            return $this->offsetGet($abstract);
        }

        if (!class_exists($abstract)) {
            throw new RuntimeException("Can not make an undefined class [$abstract]");
        }

        $reflector = new ReflectionClass($abstract);

        // 检测是否可实例化
        if (!$reflector->isInstantiable()) {
            throw new RuntimeException("The class [$abstract] is not instantiable.");
        }

        $instance = $reflector->newInstanceArgs($parameters);

        $this->offsetSet($abstract, $instance);

        return $instance;
    }
1239889
public function make($abstract, $parameters = array())
        {
            $abstract = $this->getAlias($abstract);

            // If an instance of the type is currently being managed as a singleton we'll
            // just return an existing instance instead of instantiating new instances
            // so the developer can keep using the same objects instance every time.
            if (Arrays::exists($abstract, $this->instances)) {
                return $this->instances[$abstract];
            }
            $concrete = $this->getConcrete($abstract);

            // We're ready to instantiate an instance of the concrete type registered for
            // the binding. This will instantiate the types, as well as resolve any of
            // its "nested" dependencies recursively until all have gotten resolved.
            if ($this->isBuildable($concrete, $abstract)) {
                $object = $this->build($concrete, $parameters);
            } else {
                $object = $this->make($concrete);
            }

            // If the requested type is registered as a singleton we'll want to cache off
            // the instances in "memory" so we can return it later without creating an
            // entirely new instance of an object on each subsequent request for it.
            if ($this->isShared($abstract)) {
                $this->instances[$abstract] = $object;
            }

            return $object;
        }
1304657
public function parameters(array $parameters)
    {
        foreach ($parameters as $parameter => $value) {
            if (property_exists($this->parameters, $parameter)) {
                $this->parameters->{$parameter} = $value;
            }
        }

        return $this;
    }
1037804
public function make(string $abstract, array $parameters = [])
    {
        try {
            if (! isset($this->resolving[$abstract])) {
                $this->resolving[$abstract] = $this->construct($abstract);
            }

            return $this->resolving[$abstract]($abstract, $parameters);
        } catch (ReflectionException $e) {
            throw new ContainerException("Fail while attempt to make '$abstract'", 0, $e);
        }
    }