ConversationUserController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A index() 0 12 2
1
<?php
2
3
class ConversationUserController extends \BaseController {
4
5
    /**
6
     * Display a listing of user conversations.
7
     *
8
     * @return Response
9
     */
10
    public function index($user_id) {
11
        $conversations_users = ConversationUser::where('user_id', $user_id)->lists('conversation_id');
12
13
        $conversations = array();
14
15
        if($conversations_users) {
16
            $conversations = Conversation::whereIn('id', $conversations_users)->get();
17
        }
18
19
        return Response::json([
0 ignored issues
show
Bug Best Practice introduced by
The expression return Response::json(ar...lt' => $conversations)) returns the type Illuminate\Http\JsonResponse which is incompatible with the documented return type Response.
Loading history...
20
            'success' => true,
21
            'result' => $conversations
22
        ]);
23
    }
24
}
25