Resolves the definition.

@return Definition

@throws RuntimeException When the definition is invalid
973403
private function resolveDefinition(ChildDefinition $definition)
    {
        try {
            return $this->doResolveDefinition($definition);
        } catch (ExceptionInterface $e) {
            $r = new \ReflectionProperty($e, 'message');
            $r->setAccessible(true);
            $r->setValue($e, sprintf('Service "%s": %s', $this->currentId, $e->getMessage()));

            throw $e;
        }
    }
1261936
protected function modelLoaderBuilder()
    {
        if (!isset($this->modelLoaderBuilder)) {
            throw new RuntimeException(sprintf(
                'Model Factory is not defined for [%s]',
                get_class($this)
            ));
        }

        return $this->modelLoaderBuilder;
    }
395268
public function resolveAllAction()
    {
        $this->getEntityManager()->getRepository(Exception::class)->markAllAsResolved();

        $indexUrl = $this->getAdminListConfigurator()->getIndexUrl();

        return new RedirectResponse(
            $this->generateUrl(
                $indexUrl['path'],
                isset($indexUrl['params']) ? $indexUrl['params'] : array()
            )
        );
    }
1363889
public function resolve()
    {
        if (!empty($this->resolvedParameters)) {
            return $this->attributes;
        }
        $this->evaluateRequirements($this->attributes);
        $this->resolveAllParameters();

        return $this->attributes;
    }
232814
private function resolveDefinition(Definition $definition): Definition
    {
        $definition->setArguments($this->resolveArguments($definition->getArguments()));
        $definition->setFactory($this->resolveFactory($definition->getFactory()));
        $definition->setMethodCalls($this->resolveMethodCalls($definition->getMethodCalls()));

        return $definition;
    }
90599
public function recover()
    {
        if (! class_exists($this->class)) {
            return new RuntimeException($this->message);
        }

        try {
            $reflection = new ReflectionClass($this->class);

            $e = $reflection->newInstanceWithoutConstructor();

            if (! $e instanceof Throwable) {
                throw new RuntimeException("Class [{$this->class}] is not an exception.");
            }

            foreach ($reflection->getProperties() as $property) {
                $name = $property->getName();

                if (isset($this->properties[$name])) {
                    $value = $this->properties[$name];

                    $property->setAccessible(true);

                    $property->setValue($e, $value instanceof Serialization ? $value->recover() : $value);
                }
            }

            return $e;
        } catch (Throwable $ex) {
            return new RuntimeException($this->message);
        }
    }
748825
public function create()
    {
        $entityClass = $this->getEntityName();

        $reflection = new \ReflectionClass($entityClass);

        if ($reflection->isAbstract()) {
            throw RuntimeException::createAbstract($entityClass);
        }

        return new $entityClass();
    }
55163
@SuppressWarnings("unchecked")
	public BaseRuntimeElementDefinition<?> getElementDefinition(Class<? extends IBase> theElementType) {
		validateInitialized();
		BaseRuntimeElementDefinition<?> retVal = myClassToElementDefinition.get(theElementType);
		if (retVal == null) {
			retVal = scanDatatype((Class<? extends IElement>) theElementType);
		}
		return retVal;
	}
632180
public function resolve($messageName)
    {
        if (!isset($this->classMap[$messageName])) {
            throw new \RuntimeException(
                sprintf(
                    'Could not resolve class for message %s. Did you forgot to register it?',
                    $messageName
                )
            );
        }

        return $this->classMap[$messageName];
    }
627561
public function commit()
    {
        try {
            $this->dbHandler->commit();
        } catch (Exception $e) {
            throw new RuntimeException($e->getMessage(), 0, $e);
        }
    }
1082265
public function resolve()
    {
        // TODO: Make this dynamic.

        if (is_scalar($this->value)) {
            if (is_string($this->value)) {
                return ScalarTypes::SCALAR_STRING;
            } elseif (is_bool($this->value)) {
                return ScalarTypes::SCALAR_BOOLEAN;
            } elseif (is_integer($this->value)) {
                return ScalarTypes::SCALAR_INTEGER;
            } elseif (is_float($this->value)) {
                return ScalarTypes::SCALAR_FLOAT;
            }
        } elseif (is_array($this->value)) {
            return CompoundTypes::COMPOUND_ARRAY;
        } elseif (is_object($this->value)) {
            return CompoundTypes::COMPOUND_OBJECT;
        } elseif (is_resource($this->value)) {
            return SpecialTypes::SPECIAL_RESOURCE;
        } elseif ($this->value === null) {
            return SpecialTypes::SPECIAL_NULL;
        }

        throw new UnknownTypeException(gettype($this->value));
    }
261384
public function end()
    {
        if (null === $this->ifPart) {
            throw new \RuntimeException('You must specify an if part.');
        }
        if (null === $this->thenPart) {
            throw new \RuntimeException('You must specify a then part.');
        }

        return $this->node;
    }
52795
public function resolve(&$mapping, &$obj, &$context)
    {
        if (empty($mapping)) {
            return $mapping;
        } elseif (is_array($mapping)) {
            $res = [];
            foreach ($mapping as $key => $value) {
                $resolved = $this->resolve($value, $obj, $context);

                if (null !== $resolved) {
                    $res[$key] = $resolved;
                }
            }

            return $res;
        } elseif (is_string($mapping)) {
            $dictionary = array_merge($this->dictionary, ['obj' => $obj, 'context' => $context]);
            $res = null;

            try {
                $res = @$this->evaluator->evaluateWithVars($mapping, $dictionary);
            } catch (\RuntimeException $e) {
                if ($this->debug) {
                    throw $e;
                }
            }

            return $res;
        }

        throw new \RuntimeException('Mapper expected the mapping to be a string or an array');
    }
705020
private function resolveCurrentDevice()
    {
        if (0 == $viewportWidth = $this->editor->getViewportWidth()) {
            throw new RuntimeException('Unexpected editor viewport width.');
        }

        foreach (static::getDevices() as $device => $config) {
            if ($viewportWidth >= $config['max']) {
                return $device;
            }
        }

        return static::XS;
    }
831903
public function initialize()
    {
        $modules = $this->loader->getModules();

        if (empty($modules)) {
            throw new RuntimeException('No modules found. Initialization halted');
        } else {
            $this->loadAll($modules);
            $this->modules = $modules;

            // Validate on demand
            $this->validateCoreModuleNames();
        }
    }
1221729
public function resolve(DefinitionInterface $definition)
    {
        switch (true) {
            case $definition instanceof ReferenceDefinitionInterface:
                return $this->container->get($definition->getTarget());

            case $definition instanceof ParameterDefinitionInterface:
                return $definition->getValue();

            case $definition instanceof ObjectDefinitionInterface:
                $reflection = new \ReflectionClass($definition->getClassName());

                // Create the instance
                $constructorArguments = $definition->getConstructorArguments();
                $constructorArguments = array_map([$this, 'resolveSubDefinition'], $constructorArguments);
                $service = $reflection->newInstanceArgs($constructorArguments);

                // Set properties
                foreach ($definition->getPropertyAssignments() as $propertyAssignment) {
                    $propertyName = $propertyAssignment->getPropertyName();
                    $service->$propertyName = $this->resolveSubDefinition($propertyAssignment->getValue());
                }

                // Call methods
                foreach ($definition->getMethodCalls() as $methodCall) {
                    $methodArguments = $methodCall->getArguments();
                    $methodArguments = array_map([$this, 'resolveSubDefinition'], $methodArguments);
                    call_user_func_array([$service, $methodCall->getMethodName()], $methodArguments);
                }

                return $service;

            case $definition instanceof FactoryCallDefinitionInterface:
                $factory = $definition->getFactory();
                $methodName = $definition->getMethodName();
                $arguments = (array) $definition->getArguments();
                $arguments = array_map([$this, 'resolveSubDefinition'], $arguments);

                if (is_string($factory)) {
                    return call_user_func_array([$factory, $methodName], $arguments);
                } elseif ($factory instanceof ReferenceDefinitionInterface) {
                    $factory = $this->container->get($factory->getTarget());
                    return call_user_func_array([$factory, $methodName], $arguments);
                }
                throw new InvalidDefinition(sprintf('Definition "%s" does not return a valid factory'));

            default:
                throw UnsupportedDefinition::fromDefinition($definition);
        }
    }
780073
protected function getDefinition(): DefinitionInterface
    {
        if ($this->definition === null) {
            $this->definition = (new Definition())
                ->addOption(new Option('verbose', 'Be more verbose.', 'v', 'verbose', true, true))
                ->addOption(new Option('help', 'Show help about shell or command.', 'h', 'help'));
        }

        return $this->definition;
    }