Completed
Push — master ( 67c338...c7b167 )
by Wanderson
04:24
created

Captcha   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A isValid() 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 isValid() {
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