@param MethodInvocation $invocation

@return mixed
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;
    }
1095929
public function preConditionContract(MethodInvocation $invocation): void
    {
        $object = $invocation->getThis();
        $args   = $this->fetchMethodArguments($invocation);
        $scope  = $invocation->getMethod()->getDeclaringClass()->name;

        $allContracts = $this->fetchAllContracts($invocation);
        $this->ensureContracts($invocation, $allContracts, $object, $scope, $args);
    }
1117686
public function invoke($method, $_ = null)
	{
		$params = func_get_args();
		array_shift($params);

		return $this->invokeArgs($method, $params);
	}
1193527
protected function toClassAndMethod($call)
    {
        if (is_array($call)) {
            return is_object($call[0]) ? [get_class($call[0]), $call[1]] : $call;
        }

        if (is_object($call) && method_exists($call, '__invoke')) {
            return [get_class($call), '__invoke'];
        }

        if (function_exists($call)) {
            return ['', $call];
        }

        if (class_exists($call) && method_exists($call, '__invoke')) {
            return [$call, '__invoke'];
        }

        foreach (static::$methodSeparators as $separator) {
            if (strpos($call, $separator)) {
                return explode($separator, $call, 2);
            }
        }

        throw new UnsupportedParameterException("Cannot parse '$call'.");
    }
823735
public function invokeWith($arguments = [])
    {
        $this->closeRule();

        if (empty($this->rules)) {
            $defaultAnswerCallback = $this->defaultAnswerCallback;
            $defaultAnswerCallback($this);
            $this->closeRule();
        }

        if ($arguments instanceof Arguments) {
            $argumentsArray = $arguments->all();
        } else {
            $argumentsArray = $arguments;
            $arguments = new Arguments($arguments);
        }

        foreach ($this->rules as $rule) {
            if (
                $this->matcherVerifier
                    ->matches($rule->criteria(), $argumentsArray)
            ) {
                break;
            }
        }

        $answer = $rule->next();

        foreach ($answer->secondaryRequests() as $request) {
            $this->invoker->callWith(
                $request->callback(),
                $request->finalArguments($this->self, $arguments)
            );
        }

        $request = $answer->primaryRequest();

        return $this->invoker->callWith(
            $request->callback(),
            $request->finalArguments($this->self, $arguments)
        );
    }
442830
public function invoke(Invocation $invocation)
    {
        if (is_string($this->_func) && preg_match('/^\{.+\}$/', $this->_func)) {
            $args = $invocation->getParameters();
            $_this = $invocation->getObject();

            return eval($this->_func);
        } else {
            return call_user_func_array($this->_func, $invocation->getParameters());
        }
    }
530514
protected function logInvoking(Invocation $invocation, Result $result, $time = null)
    {
        Log::channel('homer')->debug(
            sprintf('%s %5.2fms %s->%s',
                $result->hasException() ? 'Success' : 'Failure', $time, $invocation->getInterface(),
                $invocation->getMethod()
            ),
            [
                'during'      => $time,
                'arguments'   => $invocation->getArguments(),
                'attachments' => $invocation->getAttachments(),
                'result'      => $result->getValue(),
                'exception'   => $result->getException(),
            ]
        );
    }
250275
protected function invockeAction($method, $arguments)
    {
        try {
            $result = call_user_func_array([$this, $method], $arguments);
        } catch (\Exception $e) {
            $result = $this->createResponse(
                sprintf('%s::%s - %s:%s', get_class($this), $method, get_class($e), $e->getMessage()),
                500
            );
        }
        return $result;
    }
719132
public static function invocationId()
    {
        return function (callable $handler) {
            return function (
                CommandInterface $command,
                RequestInterface $request
            ) use ($handler){
                return $handler($command, $request->withHeader(
                    'aws-sdk-invocation-id',
                    md5(uniqid(gethostname(), true))
                ));
            };
        };
    }
1183416
public function invokeWith($arguments = [])
    {
        if (!$arguments instanceof Arguments) {
            $arguments = new Arguments($arguments);
        }

        return $this->callTraitMethod->invoke(
            $this->mock,
            $this->traitName,
            $this->name,
            $arguments
        );
    }
674000
public function method($constraint)
    {
        $any = new \PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
        $expects = $this->expects($any);
        return call_user_func_array(array($expects, 'method'), func_get_args());
    }
814621
private function registerInvocation(
        int $invocationID,
        int $argumentsID,
        int $endID,
        array $arguments,
        int $invocationLevel
    ) {
        //Nested invocations
        $this->locateInvocations($arguments, $invocationLevel + 1);

        list($class, $operator, $name) = $this->fetchContext($invocationID, $argumentsID);

        if (!empty($operator) && empty($class)) {
            //Non detectable
            return;
        }

        $this->invocations[] = new ReflectionInvocation(
            $this->filename,
            $this->lineNumber($invocationID),
            $class,
            $operator,
            $name,
            ReflectionArgument::locateArguments($arguments),
            $this->getSource($invocationID, $endID),
            $invocationLevel
        );
    }
331918
private function fetchContext(int $invocationTID, int $argumentsTID): array
    {
        $class = $operator = '';
        $name = trim($this->getSource($invocationTID, $argumentsTID), '( ');

        //Let's try to fetch all information we need
        if (strpos($name, '->') !== false) {
            $operator = '->';
        } elseif (strpos($name, '::') !== false) {
            $operator = '::';
        }

        if (!empty($operator)) {
            list($class, $name) = explode($operator, $name);

            //We now have to clarify class name
            if (in_array($class, ['self', 'static', '$this'])) {
                $class = $this->activeDeclaration($invocationTID);
            }
        }

        return [$class, $operator, $name];
    }
411883
public function invoke(MethodInvocation $invocation)
    {
        /** @var \Ytake\LaravelAspect\Annotation\LogExceptions $annotation */
        $annotation = $invocation->getMethod()->getAnnotation($this->annotation);
        try {
            $result = $invocation->proceed();
        } catch (\Exception $exception) {
            if ($exception instanceof $annotation->expect) {
                $logFormat = $this->logFormatter($annotation, $invocation);
                $logger = static::$logger;
                /** Monolog\Logger */
                $logFormat['context']['code'] = $exception->getCode();
                $logFormat['context']['error_message'] = $exception->getMessage();
                if ($logger instanceof LogManager) {
                    if (!is_null($annotation->driver)) {
                        $logger = $logger->driver($annotation->driver);
                    }
                    $logger->addRecord($logFormat['level'], $logFormat['message'], $logFormat['context']);
                }
            }
            throw $exception;
        }

        // @codeCoverageIgnoreStart
        return $result;
        // @codeCoverageIgnoreEnd
    }
1288166
public static function invoke( $oInstance, $methodName, $args=null ){

		//TODO tratar los args.
		$reflectionMethod = new \ReflectionMethod( get_class( $oInstance ) , $methodName);
		$value = $reflectionMethod->invoke( $oInstance, $args );
			
		return $value;
	}
823770
public function log(MethodInvocation $invocation)
    {
        /**
         * @var $request ServerRequestInterface
         * @var $response ResponseInterface
         */
        $request = $invocation->getArguments()[0];
        $response = $invocation->getArguments()[1];
        try {
            $response = $invocation->proceed();
        } catch (\Exception $ex) {
            $this->logger->critical($ex->getMessage(), $ex->getTrace());
            throw $ex;
        }

        return $response;
    }
1225524
public function argumentsOf(int $invocation = 1): array
    {
        if (isset($this->callHistory[$invocation - 1])) {
            return $this->callHistory[$invocation - 1];
        }

        $totalInvocations = $this->count();
        throw new MissingInvocation(sprintf(
                'Missing invocation #%d for %s, was %s.',
                $invocation,
                $this->name,
                ($totalInvocations === 0 ?
                        'never called' :
                        ('only called ' . ($totalInvocations === 1 ?
                            'once' : $totalInvocations . ' times')
                        )
                )
        ));
    }