private function invokeFinish(array $namedParams, array $classParams) { $invoker = new Invoker(); foreach ($this->finish as $function) { $invoker->invoke($function, $namedParams, $classParams); } }
/** * @return ResourceObject|mixed */ private function invoke() { if ($this->requests->count() === 0) { return $this->invoker->invoke($this->request); } $this->requests->attach($this->request); return $this->invoker->invokeSync($this->requests); }
public function testInvokeWithArguments() { $invoker = new Invoker(); $result = $invoker->invoke(function ($a) { return 'result'; }, ['a' => 'value1']); $this->assertSame('result', $result); }
/** * @param string $methodName * @param array $arguments * @return mixed */ public function invoke($methodName, array $arguments) { $invocation = new Invocation($methodName, $arguments); return $this->invoker->invoke($invocation); }
/** * Run the send loop through a generator * * @param callable|Generator $cbg A \Generator or a factory of a \Generator yielding promises * @return ExtendedPromiseInterface The promise of the generator's return value * @throws InvalidArgumentException */ function __invoke($cbg) : ExtendedPromiseInterface { $this->__log->debug(__FUNCTION__); $invoker = new Invoker($this->__client); if ($cbg instanceof Generator) { return $invoker->iterate($cbg)->promise(); } if (is_callable($cbg)) { return $invoker->invoke(function () use($cbg) { return $cbg($this); })->promise(); } throw InvalidArgumentException("Expected callable or Generator, got " . (is_object($cbg) ? "instance of " . get_class($cbg) : gettype($cbg) . ": " . var_export($cbg, true))); }