3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\Session\Validator
;
12 class HttpUserAgent
implements ValidatorInterface
23 * get the current user agent and store it in the session as 'valid data'
25 * @param string|null $data
27 public function __construct($data = null)
30 $data = isset($_SERVER['HTTP_USER_AGENT'])
31 ?
$_SERVER['HTTP_USER_AGENT']
38 * isValid() - this method will determine if the current user agent matches the
39 * user agent we stored when we initialized this variable.
43 public function isValid()
45 $userAgent = isset($_SERVER['HTTP_USER_AGENT'])
46 ?
$_SERVER['HTTP_USER_AGENT']
49 return ($userAgent === $this->getData());
53 * Retrieve token for validating call
57 public function getData()
63 * Return validator name
67 public function getName()