Code Duplication    Length = 9-10 lines in 3 locations

controller/main.php 3 locations

@@ 149-158 (lines=10) @@
146
		return new JsonResponse($response, 200);
147
	}
148
149
	public function load()
150
	{
151
		$friend_id = $this->request->variable('friend_id', 0);
152
153
		if ($friend_id > 0) {
154
			$messages = $this->model->getMessages($friend_id);
155
			return new JsonResponse($messages, 200);
156
		}
157
		return new JsonResponse(array('success' => false, 'error' => 'The request is invalid'), 200);
158
	}
159
160
	public function updateMessages()
161
	{
@@ 160-168 (lines=9) @@
157
		return new JsonResponse(array('success' => false, 'error' => 'The request is invalid'), 200);
158
	}
159
160
	public function updateMessages()
161
	{
162
		$friend_id = $this->request->variable('friend_id', 0);
163
		if ($friend_id > 0) {
164
			$newVal = $this->model->updateMessagesStatus($friend_id);
165
			return new JsonResponse(array('success' => true, 'newVal' => $newVal), 200);
166
		}
167
		return new JsonResponse(array('success' => false), 200);
168
	}
169
170
	public function checkForNewMessages()
171
	{
@@ 170-178 (lines=9) @@
167
		return new JsonResponse(array('success' => false), 200);
168
	}
169
170
	public function checkForNewMessages()
171
	{
172
		$friend_id = $this->request->variable('friend_id', 0);
173
		if ($friend_id > 0) {
174
			$messages = $this->model->getInboxFromId($friend_id);
175
			return new JsonResponse(array('success' => true, 'messages' => $messages), 200);
176
		}
177
		return new JsonResponse(array('success' => false), 200);
178
	}
179
180
	public function getFriends()
181
	{