Code Duplication    Length = 6-7 lines in 4 locations

app/Api/Controllers/NotificationController.php 2 locations

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

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
    /**