예제 #1
0
 public function handle($command)
 {
     $paste = $this->pasteRepository->getByHash($command->hash);
     $fork = $paste->fork($command->author, $command->code);
     $this->pasteRepository->save($fork);
     return new ForkPasteResponse($fork);
 }
예제 #2
0
 public function handle($command)
 {
     $paste = $this->pasteRepository->getByHash($command->hash);
     if (!$paste->isOwnerBy($command->author)) {
         throw new \RuntimeException('Paste is not owned by this person.... change this ');
     }
     $this->pasteRepository->delete($paste);
     return new DeletePasteResponse($paste);
 }
예제 #3
0
 public function handle($command)
 {
     return new ViewPasteResponse($this->pasteRepository->getByHash($command->hash));
 }
예제 #4
0
 public function handle($command)
 {
     $paste = Paste::createPaste($command->author, $command->code);
     $this->pasteRepository->save($paste);
     return new CreatePasteResponse($paste);
 }