Conditions | 1 |
Paths | 1 |
Total Lines | 28 |
Code Lines | 16 |
Lines | 5 |
Ratio | 17.86 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php namespace Anomaly\UsersModule; |
||
24 | public function getFunctions() |
||
25 | { |
||
26 | return [ |
||
27 | new \Twig_SimpleFunction( |
||
28 | 'user', |
||
29 | function ($identifier = null) { |
||
30 | return (new Decorator())->decorate($this->dispatch(new GetUser($identifier))); |
||
31 | } |
||
32 | ), |
||
33 | new \Twig_SimpleFunction( |
||
34 | 'role', |
||
35 | function ($identifier) { |
||
36 | return (new Decorator())->decorate($this->dispatch(new GetRole($identifier))); |
||
37 | } |
||
38 | ), |
||
39 | new \Twig_SimpleFunction( |
||
40 | 'mentions_*', |
||
41 | View Code Duplication | function ($name) { |
|
|
|||
42 | $arguments = array_slice(func_get_args(), 1); |
||
43 | |||
44 | return call_user_func_array([app(UserMentions::class), camel_case($name)], $arguments); |
||
45 | }, |
||
46 | [ |
||
47 | 'is_safe' => ['html'], |
||
48 | ] |
||
49 | ), |
||
50 | ]; |
||
51 | } |
||
52 | |||
72 |
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.