Exemplo n.º 1
0
 private function invokeFinish(array $namedParams, array $classParams)
 {
     $invoker = new Invoker();
     foreach ($this->finish as $function) {
         $invoker->invoke($function, $namedParams, $classParams);
     }
 }
Exemplo n.º 2
0
 /**
  * @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);
 }
Exemplo n.º 3
0
 public function testInvokeWithArguments()
 {
     $invoker = new Invoker();
     $result = $invoker->invoke(function ($a) {
         return 'result';
     }, ['a' => 'value1']);
     $this->assertSame('result', $result);
 }
Exemplo n.º 4
0
 /**
  * @param string $methodName
  * @param array $arguments
  * @return mixed
  */
 public function invoke($methodName, array $arguments)
 {
     $invocation = new Invocation($methodName, $arguments);
     return $this->invoker->invoke($invocation);
 }
Exemplo n.º 5
0
Arquivo: API.php Projeto: m6w6/seekat
 /**
  * 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)));
 }