Completed
Push — master ( 659231...788af6 )
by Wanderson
05:06
created

Captcha   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 1
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A isCorrect() 0 9 2
1
<?php
2
3
namespace Win\Widget;
4
5
use Win\Request\Input;
6
7
/**
8
 * Valida Captcha
9
 */
10
class Captcha {
11
12
	/**
13
	 * Retorna True se captcha está correto
14
	 * @return boolean
15
	 */
16
	public static function isCorrect() {
17
		if (isset($_SESSION['captcha'])) {
18
			$captcha = strtolower(Input::post('captcha'));
19
			$sessionCaptcha = strtolower(filter_var($_SESSION['captcha']));
20
			unset($_SESSION['captcha']);
21
			return ($captcha == $sessionCaptcha);
22
		}
23
		return false;
24
	}
25
26
}
27