Code Duplication    Length = 6-7 lines in 6 locations

app/Api/Controllers/DashboardWidgetController.php 2 locations

@@ 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
    /**
@@ 114-120 (lines=7) @@
111
            $users_widgets->size_y = $request->input('height');
112
        }
113
114
        if ($users_widgets->save())
115
        {
116
            return $this->response->array(array('statusText' => 'OK'));
117
        }
118
        else {
119
            return $this->response->errorInternal();
120
        }
121
    }
122
123
    /**

app/Api/Controllers/NotificationController.php 2 locations

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

app/Api/Controllers/DashboardController.php 2 locations

@@ 128-134 (lines=7) @@
125
            $dashboard = Dashboard::find($id);
126
            $dashboard->dashboard_name = $request->name;
127
            $dashboard->access         = $request->access;
128
            if ($dashboard->save())
129
            {
130
                return $this->response->array(array('statusText' => 'OK'));
131
            }
132
            else {
133
                return $this->response->errorInternal();
134
            }
135
        }
136
        else {
137
            $errors = $validation->errors();
@@ 152-158 (lines=7) @@
149
    {
150
        if (Dashboard::where('user_id', $request->user()->user_id)->where('dashboard_id', $id)->delete())
151
        {
152
            if (UsersWidgets::where('dashboard_id', $id)->delete() >= 0)
153
            {
154
                return $this->response->array(array('statusText' => 'OK'));
155
            }
156
            else {
157
                return $this->response->errorInternal();
158
            }
159
        }
160
        else {
161
            return $this->response->errorInternal();