Open Journal Systems  3.3.0
ClosureCommand.php
1 <?php
2 
3 namespace Guzzle\Service\Command;
4 
8 
15 {
20  protected function init()
21  {
22  if (!$this['closure']) {
23  throw new InvalidArgumentException('A closure must be passed in the parameters array');
24  }
25  }
26 
31  protected function build()
32  {
33  $closure = $this['closure'];
35  $this->request = $closure($this, $this->operation);
36 
37  if (!$this->request || !$this->request instanceof RequestInterface) {
38  throw new UnexpectedValueException('Closure command did not return a RequestInterface object');
39  }
40  }
41 }
Guzzle\Service\Command\ClosureCommand\build
build()
Definition: ClosureCommand.php:31
Guzzle\Http\Message\RequestInterface
Definition: lib/vendor/guzzle/guzzle/src/Guzzle/Http/Message/RequestInterface.php:16
Guzzle\Service\Command
Definition: AbstractCommand.php:3
Guzzle\Service\Command\ClosureCommand\init
init()
Definition: ClosureCommand.php:20
Guzzle\Common\Exception\UnexpectedValueException
Definition: lib/vendor/guzzle/guzzle/src/Guzzle/Common/Exception/UnexpectedValueException.php:5
Guzzle\Service\Command\ClosureCommand
Definition: ClosureCommand.php:14
Guzzle\Common\Exception\InvalidArgumentException
Definition: lib/vendor/guzzle/guzzle/src/Guzzle/Common/Exception/InvalidArgumentException.php:5
Guzzle\Service\Command\AbstractCommand
Definition: AbstractCommand.php:21