Code Duplication    Length = 18-24 lines in 3 locations

app/Controller/ApiController.php 3 locations

@@ 260-283 (lines=24) @@
257
		return;	
258
	}
259
260
	public function loginClient($dados)
261
	{
262
263
    	$conditions = array(
264
			'ativo' => 1,
265
			'id_usuario' => $this->getIdUser(),
266
			'email' => $dados['email'],
267
			'senha' => sha1($dados['senha'])
268
		);
269
270
	    $cliente = $this->Cliente->find('all', 
271
			array('conditions' => 
272
				$conditions
273
			)
274
		);
275
276
	    if (!empty($cliente)) {
277
			$this->response->body('{"message": "success", "result":'.json_encode($cliente).'}');
278
			return;
279
	    }
280
		
281
		$this->response->body('{"message": "error"}');
282
		return;	    
283
	}
284
285
	public function postClient($dados)
286
	{
@@ 336-353 (lines=18) @@
333
	}
334
335
336
	public function postParent($dados)
337
	{
338
    	$dados = array(
339
			'senha'      => sha1($dados['senha']),
340
			'usuario_id' => $this->getIdUser(),
341
			'cliente_id' => $dados['cliente_id'],
342
			'login'      => $dados['login'],
343
			'ativo'      => 1,
344
		);
345
		
346
		if ($this->Parente->save($dados)) {
347
			$this->response->body('{"message": "success", "result":'.json_encode($dados).'}');
348
			return;
349
		}
350
351
		$this->response->body('{"message": "error"}');
352
		return;
353
	}
354
355
	public function loginParent($dados) 
356
	{
@@ 355-377 (lines=23) @@
352
		return;
353
	}
354
355
	public function loginParent($dados) 
356
	{
357
    	$conditions = array(
358
			'ativo' => 1,
359
			'usuario_id' => $this->getIdUser(),
360
			'login' => $dados['login'],
361
			'senha' => sha1($dados['senha'])
362
		);
363
364
	    $parente = $this->Parente->find('all', 
365
			array('conditions' => 
366
				$conditions
367
			)
368
		);
369
370
	    if (!empty($parente)) {
371
			$this->response->body('{"message": "success", "result":'.json_encode($parente).'}');
372
			return;
373
	    }
374
		
375
		$this->response->body('{"message": "error"}');
376
		return;	
377
	}
378
379
	public function putParent($dados, $id_parente) 
380
	{