inputReader = $inputReader; $this->postService = $postService; $this->postNotesService = $postNotesService; $this->privilegeService = $privilegeService; $this->postNoteViewProxy = $postNoteViewProxy; } public function getMethods() { return ['POST']; } public function getUrl() { return '/api/notes/:postNameOrId'; } public function work($args) { $post = $this->postService->getByNameOrId($args['postNameOrId']); $this->privilegeService->assertPrivilege(Privilege::ADD_POST_NOTES); $formData = new PostNoteFormData($this->inputReader); $postNote = $this->postNotesService->createPostNote($post, $formData); return $this->postNoteViewProxy->fromEntity($postNote); } }