Code Duplication    Length = 6-7 lines in 4 locations

app/Api/Controllers/DashboardController.php 1 location

@@ 155-161 (lines=7) @@
152
    {
153
        if (Dashboard::where('user_id', $request->user()->user_id)->where('dashboard_id', $id)->delete())
154
        {
155
            if (UsersWidgets::where('dashboard_id', $id)->delete() >= 0)
156
            {
157
                return $this->response->array(array('statusText' => 'OK'));
158
            }
159
            else {
160
                return $this->response->errorInternal();
161
            }
162
        }
163
        else {
164
            return $this->response->errorInternal();

app/Api/Controllers/DashboardWidgetController.php 1 location

@@ 59-65 (lines=7) @@
56
        $user_widget->size_y         = $request->size_y;
57
        $user_widget->title          = $request->title;
58
        $user_widget->dashboard_id   = $request->dashboard_id;
59
        if ($user_widget->save())
60
        {
61
            return $this->response->array(array('statusText' => 'OK', 'user_widget_id' => $user_widget->user_widget_id));
62
        }
63
        else {
64
            return $this->response->errorInternal();
65
        }
66
    }
67
68
    /**

app/Api/Controllers/NotificationController.php 2 locations

@@ 49-54 (lines=6) @@
46
            $result = $notification->markSticky(false);
47
        }
48
49
        if ($result === false) {
50
            return $this->response->errorInternal();
51
        }
52
        else {
53
            return $this->response->array(array('statusText' => 'OK'));
54
        }
55
    }
56
57
    /**
@@ 69-75 (lines=7) @@
66
        $notification->body = $request->body;
67
        $notification->checksum = hash('sha512', $request->user()->user_id.'.LOCAL.'.$request->title);
68
        $notification->source = $request->user()->user_id;
69
        if ($notification->save()) {
70
            return $this->response->array(array('statusText' => 'OK'));
71
        }
72
        else {
73
            return $this->response->errorInternal();
74
        }
75
    }
76
77
}
78