Conditions | 3 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | public function savePost(User $user, Post $model, PostForm $form): void |
||
24 | { |
||
25 | $model->setTitle($form->getTitle()); |
||
26 | $model->setContent($form->getContent()); |
||
|
|||
27 | $model->resetTags(); |
||
28 | |||
29 | foreach ($form->getTags() as $tag) { |
||
30 | $model->addTag($this->tagRepository->getOrCreate($tag)); |
||
31 | } |
||
32 | |||
33 | if ($model->isNewRecord()) { |
||
34 | $model->setPublic(true); |
||
35 | $model->setUser($user); |
||
36 | } |
||
37 | |||
38 | $this->repository->save($model); |
||
39 | } |
||
49 |