コード例 #1
0
ファイル: CommandBus.php プロジェクト: RonRademaker/tactician
 /**
  * Executes the given command and optionally returns a value
  *
  * @param object $command
  *
  * @return mixed
  */
 public function handle($command)
 {
     if (!is_object($command)) {
         throw InvalidCommandException::forUnknownValue($command);
     }
     $middlewareChain = $this->middlewareChain;
     return $middlewareChain($command);
 }
コード例 #2
0
 public function testExceptionContainsDebuggingInfo()
 {
     $command = 'must be an object';
     $exception = InvalidCommandException::forUnknownValue($command);
     $this->assertContains('type: string', $exception->getMessage());
     $this->assertSame($command, $exception->getInvalidCommand());
     $this->assertInstanceOf(Exception::class, $exception);
 }
コード例 #3
0
 /**
  * @inheritDoc
  */
 public function handle($command)
 {
     if (!is_object($command)) {
         throw InvalidCommandException::forUnknownValue($command);
     }
     $this->checkTransactionIsRunning();
     $this->commandsToCommit[] = $command;
     return true;
 }