/** @return CommandInvoker */
 protected function getCommandInvoker()
 {
     if ($this->commandInvoker) {
         return $this->commandInvoker;
     }
     $commandInvoker = new CommandInvoker();
     $commandInvoker->addCommand(new LineInsertAboveCommand($this->getTextSanitizer(), $this->getLocationSanitizer()));
     $commandInvoker->addCommand(new LineInsertBelowCommand($this->getTextSanitizer(), $this->getLocationSanitizer()));
     $commandInvoker->addCommand(new LineReplaceAllCommand($this->getContentFactory(), $this->getTextSanitizer()));
     $commandInvoker->addCommand(new LineReplaceCommand($this->getTextSanitizer(), $this->getLocationSanitizer()));
     $commandInvoker->addCommand(new LineRemoveCommand($this->getTextSanitizer(), $this->getLocationSanitizer()));
     foreach ($this->commands as $command) {
         $commandInvoker->addCommand($command);
     }
     return $commandInvoker;
 }
Beispiel #2
0
 function it_runs_a_command(CommandInvoker $commandInvoker)
 {
     $name = 'walk_in_a_silly_way';
     $input = array();
     $commandInvoker->run($name, $input)->shouldBeCalled();
     $this->run($name, $input);
 }
Beispiel #3
0
 /**
  * Provides access to the CommandInvoker.
  *
  * @param string $name
  * @param array  $input
  *
  * @throws \Gnugat\Redaktilo\Exception\CommandNotFoundException If the command isn't found in the CommandInvoker
  *
  * @api
  */
 public function run($name, array $input)
 {
     $this->commandInvoker->run($name, $input);
 }