Code Duplication    Length = 12-12 lines in 2 locations

app/Controller/BannerController.php 1 location

@@ 110-121 (lines=12) @@
107
		}
108
	}
109
110
	public function uploadImage(&$image) {
111
		$type = substr($image['name'], -4);
112
		$nameImage = uniqid() . md5($image['name']) . $type;
113
		$dir = APP . 'webroot/uploads/banner/imagens/';
114
		
115
		$returnUpload = move_uploaded_file($image['tmp_name'], $dir . $nameImage);
116
117
		if (!$returnUpload)
118
			return array('nome' => null, 'status' => false);
119
120
		return array('nome' => $nameImage, 'status' => true);
121
	}
122
123
	public function excluir_cadastro() {
124
		$this->layout = 'ajax';

app/Controller/ProdutoController.php 1 location

@@ 476-487 (lines=12) @@
473
		return number_format($retorno, 2, ',', '.');
474
	}
475
476
	public function uploadImage(&$image) {
477
		$type = substr($image['name'], -4);
478
		$nameImage = uniqid() . md5($image['name']) . $type;
479
		$dir = APP . 'webroot/uploads/produto/imagens/';
480
		
481
		$returnUpload = move_uploaded_file($image['tmp_name'], $dir . $nameImage);
482
483
		if (!$returnUpload)
484
			return array('nome' => null, 'status' => false);
485
486
		return array('nome' => $nameImage, 'status' => true);
487
	}
488
489
	public function visualizar_cadastro($id) {
490
		$this->layout = 'wadmin';