1 | <?php |
||
22 | class Updater extends RepositoryUpdater |
||
23 | { |
||
24 | /** |
||
25 | * @var Comment |
||
26 | */ |
||
27 | protected $model; |
||
28 | |||
29 | public function __construct(Comment $model) |
||
33 | |||
34 | /** |
||
35 | * Create new comment. |
||
36 | * |
||
37 | * @param array $input |
||
38 | * |
||
39 | * @return Comment |
||
40 | */ |
||
41 | public function create(array $input) |
||
80 | |||
81 | /** |
||
82 | * Update comment body. |
||
83 | * |
||
84 | * @param string $body |
||
85 | * |
||
86 | * @return Comment |
||
87 | */ |
||
88 | public function updateBody($body) |
||
101 | |||
102 | public function delete() |
||
106 | |||
107 | /** |
||
108 | * Delete a comment and its attachments. |
||
109 | * |
||
110 | * @return Comment |
||
111 | * |
||
112 | * @throws \Exception |
||
113 | */ |
||
114 | protected function deleteComment() |
||
129 | |||
130 | /** |
||
131 | * Insert add comment to message queue. |
||
132 | * |
||
133 | * @param Comment $comment |
||
134 | * @param User $changeBy |
||
135 | * |
||
136 | * @return void |
||
137 | */ |
||
138 | public function queueAdd(Comment $comment, User $changeBy) |
||
147 | |||
148 | /** |
||
149 | * Insert update comment to message queue. |
||
150 | * |
||
151 | * @param Comment $comment |
||
152 | * @param User $changeBy |
||
153 | * |
||
154 | * @return void |
||
155 | */ |
||
156 | public function queueUpdate(Comment $comment, User $changeBy) |
||
165 | |||
166 | /** |
||
167 | * Insert delete comment to message queue. |
||
168 | * |
||
169 | * @param Comment $comment |
||
170 | * @param User $changeBy |
||
171 | * |
||
172 | * @return void |
||
173 | */ |
||
174 | public function queueDelete(Comment $comment, User $changeBy) |
||
183 | } |
||
184 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.