Get real FactoryArgument value
@throws ServiceManagerException

@return mixed
505104
public function value()
    {

        // Get real arguments values from Argument instances
        $arguments = [];
        foreach ($this->arguments as $arg) {
            $arguments[] = $arg->value();
        }
        $this->arguments = $arguments;

        if ($this->value->startsWith('@')) {
            // Service can only be called in a NON-STATIC context
            $arguments = $this->arr($this->arguments)->count() > 0 ? $this->arguments : null;

            return ServiceManager::getInstance()->getService($this->value->val(), $arguments);
        } else {
            // CLASS can be instantiated or called statically
            $value = $this->value->val();
            if (class_exists($value) && !$this->static) {
                $reflection = new \ReflectionClass($value);

                return $reflection->newInstanceArgs($this->arguments);
            } elseif (class_exists($value) && $this->static) {
                // Return class name for static call
                return $this->value->val();
            }
            throw new ServiceManagerException(ServiceManagerException::SERVICE_CLASS_DOES_NOT_EXIST, [$this->value]);
        }
    }
1033863
private function getArguments(): array
    {
        $results = [];

        $results[] = 'service';
        $results[] = "--consumer={$this->config->getConsumer()}";
        $results[] = "--provider={$this->config->getProvider()}";
        $results[] = "--pact-dir={$this->config->getPactDir()}";
        $results[] = "--pact-file-write-mode={$this->config->getPactFileWriteMode()}";
        $results[] = "--host={$this->config->getHost()}";
        $results[] = "--port={$this->config->getPort()}";

        if ($this->config->hasCors()) {
            $results[] = '--cors=true';
        }

        if ($this->config->getPactSpecificationVersion() !== null) {
            $results[] = "--pact-specification-version={$this->config->getPactSpecificationVersion()}";
        }

        if ($this->config->getLog() !== null) {
            $results[] = "--log={$this->config->getLog()}";
        }

        return $results;
    }
828145
public function getService($args = null) {
		if ($this->isFactory()) {
			return $this->getServiceByFactory();
		}
		
		if ($args === null) {
			return $this->getCommonService();
		}
		
		return $this->getServiceByArgs($args);
	}
299667
public function defaultArguments()
    {
        static $arguments;

        if ($arguments === null) {
            $validateFieldName = function ($response) {
                return is_string($response) && strlen($response) > 0;
            };

            $validateCallback = function ($response) {
                return is_string($response) && (strpos($callable, '::') > 1 || function_exists($response));
            };

            $validateModel = function ($response) {
                if (strlen($response) === 0) {
                    return false;
                }

                try {
                    $this->modelFactory()->get($response);
                } catch (Exception $e) {
                    unset($e);

                    return false;
                }

                return true;
            };

            $validateModels = function ($response) {
                if (strlen($response) === 0) {
                    return false;
                }

                try {
                    $arr = $this->parseAsArray($response);
                    foreach ($arr as $model) {
                        $this->resolveRelatedModel($model);
                    }
                } catch (Exception $e) {
                    unset($e);

                    return false;
                }

                return true;
            };

            $arguments = [
                'keep_id'       => [
                    'longPrefix'  => 'keep-id',
                    'noValue'     => true,
                    'description' => 'Skip the deletion of the ID field to be replaced.',
                ],
                'id_generator'  => [
                    'longPrefix'   => 'id-generator',
                    'required'     => false,
                    'description'  => 'A function or a method on the model to generate an ID.',
                    'prompt'       => 'What function to generate a unique ID?',
                    'acceptValue'  => $validateCallback->bindTo($this),
                    'defaultValue' => null,
                ],
                'old_key'  => [
                    'longPrefix'   => 'old-key',
                    'required'     => false,
                    'description'  => 'The model\'s deprecated ID field to replace.',
                    'prompt'       => 'What is the model\'s deprecated primary key?',
                    'acceptValue'  => $validateFieldName->bindTo($this),
                    'defaultValue' => null,
                ],
                'target_model'  => [
                    'prefix'      => 'o',
                    'longPrefix'  => 'obj-type',
                    'required'    => true,
                    'description' => 'The object type to alter.',
                    'prompt'      => 'What model must be altered?',
                    'acceptValue' => $validateModel->bindTo($this),
                ],
                'related_model' => [
                    'prefix'      => 'r',
                    'longPrefix'  => 'related-obj-type',
                    'description' => 'Properties of related object types to synchronize (ObjType:propertyIdent,…).',
                    'prompt'      => 'List related models and properties (ObjType:propertyIdent,…):',
                    'acceptValue' => $validateModels->bindTo($this),
                ],
            ];

            $arguments = array_merge(parent::defaultArguments(), $arguments);
        }

        return $arguments;
    }
636265
public function getArgument()
    {
        $real = $this->getReal()->toNative();
        $im   = $this->getIm()->toNative();
        $arg  = \atan2($im, $real);

        return new Real($arg);
    }
1022006
public function initFactoriedServices()
    {
        $config = $this->getConfig();
        if (!isset($config['service_manager'])) {
            return $this;
        }
        
        $smConfig = $config['service_manager'];
        if (!isset($smConfig['factories'])) {
            return $this;
        }
        $factories = $smConfig['factories']->toArray();
        $shared    = isset($smConfig['shared']) ? $smConfig['shared']->toArray() : [];
        foreach ($factories as $serviceName => $serviceConfig) {
            $isShare = isset($shared[$serviceName]) ? (bool) $shared[$serviceName] : true;
            $this->setServiceFactories($serviceName, $serviceConfig, $isShare);
        }

        return $this;
    }
444859
protected function getServiceByFactory() {
		if ($this->arguments === null) {
			return $this->initService();
		}

		$args = $this->normalizeArgs($this->arguments);
		$args = $this->processArgs($args);
		
		return $this->initService($args);
	}
1169732
public function get($handlerServiceId)
    {
        $handler = $this->container->get($handlerServiceId);

        if (!$handler instanceof CommandHandlerInterface) {
            throw new \InvalidArgumentException('Handler must be instance if ' . CommandHandlerInterface::class);
        }

        return $handler;
    }
1317025
public function getServiceManager()
    {
        $serviceManager = $this->getServiceLocator();
        if ($serviceManager instanceof ServiceManager) {
            return $serviceManager;
        }
        $msg = is_null($serviceManager)
            ? 'ServiceLocator not initialized for '.get_class($this)
            : 'Alternate service locator not compatible with getServiceManager() in ' . __CLASS__;
        throw new InvalidServiceManagerException($msg);
    }
65734
private function findArgumentToReplace(Definition $definition, ServiceConfig $serviceConfig)
    {
        $container = $serviceConfig->is(ServiceConfig::CONTAINER);

        if ($serviceConfig->has(ServiceConfig::ARGUMENT)) {
            return (int) $serviceConfig->get(ServiceConfig::ARGUMENT);
        } else {
            $possible = array();
            $ref = new \ReflectionClass($definition->getClass());

            foreach ($ref->getConstructor()->getParameters() as $argumentNr => $argument) {
                if ($argument->isArray() && !$container) {
                    $possible[] = $argumentNr;
                } else {
                    if ((null !== $class = $argument->getClass()) && $class->isInstance(new $this->containerClass())) {
                        $possible[] = $argumentNr;
                    }
                }
            }
        }

        if (1 === count($possible)) {
            return current($possible);
        }

        throw new \Exception('unable to find the argument to replace');
    }
1302867
public function getService()
    {
        if (!$this->service) {
            /** @var \OAuth\ServiceFactory $serviceFactory */
            $serviceFactory = $this->app->make('oauth/factory/service');
            $this->service = $this->factory->createService($serviceFactory);
        }

        return $this->service;
    }
678941
public function args()
    {
        $existing = is_callable($this->args) ? call_user_func($this->args) : $this->args;

        if (!is_array($existing)) {
            $existing = [];
        }

        $args = array_merge($existing, [
            'limit' => [
                'type' => Type::int(),
            ],
            'offset' => [
                'type' => Type::int()
            ]
        ]);

        if ($fields = $this->getSortableFields()) {
            $args['sortBy'] = [
                'type' => Type::listOf(
                    Injector::inst()->create(SortInputTypeCreator::class, $this->connectionName)
                        ->setSortableFields($fields)
                        ->toType()
                )
            ];
        }

        return $args;
    }
373233
public function compile()
    {
        $this->manageInheritance();
        $this->serviceConfig = $this->insertParameters($this->serviceConfig);
        $this->buildArguments('Arguments');
        $this->buildArguments('MethodArguments');
        $this->buildCallsArguments();
        $this->buildFactoryArgument();

        return $this->buildServiceConfig();
    }
1374897
public function getObjectManager(): ObjectManagerInterface
    {
        if (!isset($this->earlyInstances[ObjectManagerInterface::class])) {
            debug_print_backtrace();
            throw new FlowException('The Object Manager is not available at this stage of the bootstrap run.', 1301120788);
        }
        return $this->earlyInstances[ObjectManagerInterface::class];
    }
123248
public function get($serviceName, array $args = [])
    {
        if ($this->getContainer()->has($serviceName)) {
            return $this->getContainer()->get($serviceName, $args);
        }

        return null;
    }
1047764
public function getMockedArgValue($elementName, $argName)
    {
        if (isset($this->_mockedArguments[$elementName]) && isset($this->_mockedArguments[$elementName][$argName])) {
            $response = $this->_mockedArguments[$elementName][$argName];
            if (is_callable($response)) {
                $response = call_user_func($response);
            }
            return $response;
        }
        
        return false;
    }
1273105
public function getValue()
    {
        try {
            return JsonValidator::validate($this->value) ? $this->value : '';
        } catch (InvalidArgumentException $e) {
            return $e->getMessage();
        }
    }