@param AbstractInvoke $invoke

@return AbstractInvoke
193561
private function preProcess(AbstractInvoke $invoke): AbstractInvoke
    {
        $result = $this->preProcess->handle(new ProcessorContainer($this, $invoke));

        if ($result instanceof ProcessorContainer) {
            return $result->getInvoke();
        }

        throw new \RuntimeException();
    }
224780
protected function handleInvocation(Invocation $invocation)
    {
        $invoker = $this->dispatchInvocation($invocation);

        return $invoker->invoke($invocation);
    }
923792
public function invoke(MethodInvocation $methodInvocation, MethodCall $methodCall, Message $requestMessage)
    {
        $methodInvocationType = TypeDescriptor::create(MethodInvocation::class);

        $hasMethodInvocation = false;
        $argumentsToCallInterceptor = [];
        $interceptedInstanceType = TypeDescriptor::createFromVariable($methodInvocation->getInterceptedInstance());
        $referenceSearchServiceTypeDescriptor = TypeDescriptor::create(ReferenceSearchService::class);
        $messageType = TypeDescriptor::create(Message::class);

        foreach ($this->interceptorInterfaceToCall->getInterfaceParameters() as $parameter) {
            $resolvedArgument = null;

            foreach ($methodCall->getMethodArguments() as $methodArgument) {
                if ($methodArgument->hasSameTypeAs($parameter)) {
                    $resolvedArgument = $methodArgument->value();
                }
            }

            if (!$resolvedArgument && $parameter->hasType($methodInvocationType)) {
                $hasMethodInvocation = true;
                $resolvedArgument = $methodInvocation;
            }

            if (!$resolvedArgument && $parameter->hasType($interceptedInstanceType)) {
                $resolvedArgument = $methodInvocation->getInterceptedInstance();
            }

            if (!$resolvedArgument && $parameter->hasType($messageType)) {
                $resolvedArgument = $requestMessage;
            }

            if (!$resolvedArgument) {
                if ($methodInvocation->getInterceptedInterface()->hasMethodAnnotation($parameter->getTypeDescriptor())) {
                    $resolvedArgument = $methodInvocation->getInterceptedInterface()->getMethodAnnotation($parameter->getTypeDescriptor());
                }
                if ($methodInvocation->getInterceptedInterface()->hasClassAnnotation($parameter->getTypeDescriptor())) {
                    $resolvedArgument = $methodInvocation->getInterceptedInterface()->getClassAnnotation($parameter->getTypeDescriptor());
                }
            }

            if (!$resolvedArgument) {
                foreach ($methodInvocation->getEndpointAnnotations() as $endpointAnnotation) {
                    if (TypeDescriptor::createFromVariable($endpointAnnotation)->equals($parameter->getTypeDescriptor())) {
                        $resolvedArgument = $endpointAnnotation;
                        break;
                    }
                }
            }

            if (!$resolvedArgument) {
                if ($parameter->hasType($referenceSearchServiceTypeDescriptor)) {
                    $resolvedArgument = $this->referenceSearchService;
                }
            }

            if (!$resolvedArgument && !$parameter->doesAllowNulls()) {
                throw MethodInvocationException::create("{$this->interceptorInterfaceToCall} can't resolve argument for parameter with name `{$parameter->getName()}`. Maybe your docblock type hint is not correct?");
            }

            $argumentsToCallInterceptor[] = $resolvedArgument;
        }

        $returnValue = call_user_func_array(
            [$this->referenceToCall, $this->interceptorInterfaceToCall->getMethodName()],
            $argumentsToCallInterceptor
        );

        if (!$hasMethodInvocation) {
            return $methodInvocation->proceed();
        }

        return $returnValue;
    }
347558
public function afterMethodExecution(MethodInvocation $invocation)
    {
        $filesystemAdapter = new Local(APP_BASE_DIR . 'storage/cache/api/');
        $filesystem        = new Filesystem($filesystemAdapter);

        $pool = new FilesystemCachePool($filesystem);

        $cacheKey = "products_" . md5(implode('_', $invocation->getArguments()));

        $item = $pool->getItem($cacheKey);
        $normalizer = new ObjectNormalizer();

        if ($item->isHit()) { // found the item in cache
            /** @var MapProduct $cacheItem */
            $cacheItem = $normalizer->denormalize($item->get(), MapProduct::class);
            return $cacheItem;
        }

        // execute the API call
        /** @var \KickAss\Commerce\Product\Map\Product $returnValue */
        $returnValue = $invocation->proceed();

        $item->set($normalizer->normalize($returnValue, 'array'))
            ->setTags(['products']);
        $item->expiresAfter(3600);

        $pool->save($item);

        // return value as expected
        return $returnValue;
    }
582077
public function context(string $prefix, $invoker) 
	{
		return parent::context($prefix, function() use ($invoker) {
			return $this->injector->invoke(
				Container::getDependencyArray($handler), [], [$this]
			);
		});
	}
650487
protected function invokeLogging() {
        $this->config['log'] = [
            'colorize' => true,
            'verbosity' => Log::ALL | ~Log::DEBUG
        ];

        $this->log = new Log();

        return $this;
    }
1175683
public function invoke(MethodInvocation $invocation)
    {
        list($onValidate, $onFailure) = $this->getOnValidate($invocation->getMethod());
        list($isValid, $failure) = $this->validate($invocation, $onValidate, $onFailure);
        if ($isValid === true) {
            // validation success
            return $invocation->proceed();
        }

        // onFailure
        return $failure;
    }
1237193
protected function dispatchInvocation(Invocation $invocation)
    {
        $interface = $invocation->getInterface();

        if (isset($this->invokers[$interface])) {
            return $this->invokers[$interface];
        }

        throw new CallingException("No invoker found for {$interface}.");
    }
1154423
public function invoke(MethodInvocation $invocation)
    {
        /** @var ResourceObject $ro */
        $ro = $invocation->getThis();
        $method = $invocation->getMethod();
        $query = $this->getArgsByInvocation($invocation);
        $embeds = $this->reader->getMethodAnnotations($method);
        $this->embedResource($embeds, $ro, $query);

        return $invocation->proceed();
    }
843465
public function getInvoker()
    {
        if ($this->invoker !== null) {
            return $this->invoker;
        }

        return $this->invoker = $this->createInvoker();
    }
846814
protected function createCurrentPollTask($invocationId, $highestCommitedUSN, $rootDseDnsHostName, $lastSuccessfulPollTask, $isFullSync)
    {
        $currentTask = new PollTask(
            $this->name,
            $invocationId,
            $highestCommitedUSN,
            $rootDseDnsHostName,
            $lastSuccessfulPollTask,
            $isFullSync
        );

        return $currentTask;
    }
324386
function fresh($nameOrAlias, $invOpt = array())
    {
        $orgName = $nameOrAlias;

        if (!(strpos($nameOrAlias, self::SEPARATOR) !== false))
            $nameOrAlias = $this->getExtended($nameOrAlias);

        # check if we have alias to nested service:
        if (strpos($nameOrAlias, self::SEPARATOR) !== false) {
            // shared alias for nested container
            /* @see Container::extend */

            $xService    = explode(self::SEPARATOR, $nameOrAlias);
            $nameOrAlias = array_pop($xService);

            $x = implode(self::SEPARATOR, $xService);
            if ($x === '') $x = self::SEPARATOR;

            if ( false === $nestContainer = $this->from($x) )
                throw new \Exception(sprintf('Nested Container (%s) not found.', $x));

            return $nestContainer->fresh($nameOrAlias, $invOpt);
        }


        // ..

        if (!$this->has($nameOrAlias))
            throw new exContainerNoService(sprintf(
                '%s (%s) was requested in Container@%s but no service could be found.'
                , ($nameOrAlias !== $orgName)
                ? "Service ($nameOrAlias) with alias"
                : 'Service'
                , $orgName
                , $this->getPath().'#'.get_class($this)
            ));

        # Attain Service Instance:
        $inService = $this->_attainCService($nameOrAlias);

        # Refresh Service:
        try
        {
            ## invokeOptions used to build service
            $inService = clone $inService;
            if ($invOpt) $inService->with( $inService::parseWith($invOpt) );

            $instance = $this->_createFromService($inService);
            if ($instance === null)
                throw new \Exception(sprintf(
                    'service (%s) meanwhile found but create nothing(null).'
                    , $nameOrAlias
                ));
        }
        catch(\Exception $e) {
            throw new exContainerCreateService(sprintf(
                'An exception was raised while creating (%s); no instance returned.'
                , $orgName
            ), $e->getCode(), $e);
        }

        // TODO it could be added as an initializer
        # initialize retrieved service to match with defined implementation interface
        $this->_validateImplementation($orgName, $instance);
        return $instance;
    }
1080313
public function make( $abstract )
	{
		$service = isset( $this->services[$abstract] )
			? $this->services[$abstract]
			: $this->addNamespace( $abstract );

		if( is_callable( $service )) {
			return call_user_func_array( $service, [$this] );
		}
		if( is_object( $service )) {
			return $service;
		}

		return $this->resolve( $service );
	}
1058207
protected function invokeCallbacks(AbstractJob $job)
    {
        $result = $job->getResult();

        if ($result->isRedirect() || $result->isRetry()) {
            return $this;
        }

        if ($result->isError()) {
            $callbackJobs = $job->getCallbacksError();
        } else {

            $callbackJobs = $job->getCallbacksDone();
            if($result->isSuccess()){
                $callbackJobs = $callbackJobs + $job->getCallbacksSuccess();
            } else {
                $callbackJobs = $callbackJobs + $job->getCallbacksError();
            }
        }

        if (!is_array($callbackJobs) || count($callbackJobs) === 0) {
            return $this;
        }

        foreach ($callbackJobs as $index => $callbackJob) {
            /** @var $callbackJob AbstractJob */
            $callbackJob($job);
        }

        return $this;
    }
859058
public function invoke(MethodInvocation $invocation)
    {
        /** @var \Ytake\LaravelAspect\Annotation\Loggable $annotation */
        $annotation = $invocation->getMethod()->getAnnotation($this->annotation);
        $start = microtime(true);
        $result = $invocation->proceed();
        $time = number_format(microtime(true) - $start, 15);
        $logFormat = $this->logFormatter($annotation, $invocation);
        $logger = static::$logger;
        if (!$annotation->skipResult) {
            $logFormat['context']['result'] = $result;
        }
        $logFormat['context']['time'] = $time;
        /** Monolog\Logger */
        if ($logger instanceof LogManager) {
            if (!is_null($annotation->driver)) {
                $logger = $logger->driver($annotation->driver);
            }
            $logger->addRecord($logFormat['level'], $logFormat['message'], $logFormat['context']);
        }

        return $result;
    }
357954
public function invoke(MethodInvocation $invocation)
    {
        $annotation = $invocation->getMethod()->getAnnotation($this->annotation);
        $keys = $this->generateCacheName($annotation->cacheName, $invocation);
        if (!is_array($annotation->key)) {
            $annotation->key = [$annotation->key];
        }
        $keys = $this->detectCacheKeys($invocation, $annotation, $keys);

        // detect use cache driver
        $cache = $this->detectCacheRepository($annotation);

        if ($annotation->allEntries) {
            $cache->flush();

            return $invocation->proceed();
        }
        $result = $invocation->proceed();
        $cache->forget($this->recursiveImplode($this->join, $keys));

        return $result;
    }
540523
protected function createObject($abstract=null, array $parameters=[])
    {

        $abstract = $this->factoryAbstract($abstract);

        if (!$this->_customFactory) {
            return $this->createWithoutFactory($abstract, $parameters);
        }

        return Lambda::callFast($this->_customFactory, [$abstract, $parameters]);
    }