Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
22 | public function __invoke($hook, $type, AjaxResponse $response, $params) { |
||
23 | $entity = get_entity(get_input('guid')); |
||
|
|||
24 | if (!$entity) { |
||
25 | return; |
||
26 | } |
||
27 | |||
28 | $response->getData()->likes_status = [ |
||
29 | 'guid' => $entity->guid, |
||
30 | 'count' => likes_count($entity), |
||
31 | 'count_menu_item' => elgg_view_menu_item(_likes_count_menu_item($entity)), |
||
32 | 'like_menu_item' => elgg_view_menu_item(_likes_menu_item($entity)), |
||
33 | 'is_liked' => DataService::instance()->currentUserLikesEntity($entity->guid), |
||
34 | ]; |
||
35 | |||
36 | return $response; |
||
37 | } |
||
39 |