Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 14 |
Ratio | 100 % |
Changes | 0 |
1 | <?php |
||
35 | public function __invoke(MenuOfCodeQuery $query) |
||
36 | { |
||
37 | $code = new MenuCode($query->code()); |
||
38 | $locale = new Locale($query->locale()); |
||
39 | |||
40 | $menu = $this->repository->menuOfCode($code); |
||
41 | if (!$menu instanceof Menu) { |
||
42 | throw new MenuDoesNotExistException(); |
||
43 | } |
||
44 | |||
45 | $this->dataTransformer->write($menu, $locale); |
||
46 | |||
47 | return $this->dataTransformer->read(); |
||
48 | } |
||
49 | } |
||
50 |
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.