mirror of
https://github.com/sruupl/batflat.git
synced 2026-07-04 15:38:20 +02:00
Add Batflat 1.3.4 to repository
This commit is contained in:
56
inc/modules/statistics/phpbrowserdetector/UserAgent.php
Normal file
56
inc/modules/statistics/phpbrowserdetector/UserAgent.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Inc\Modules\Statistics\PHPBrowserDetector;
|
||||
|
||||
class UserAgent
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $userAgentString;
|
||||
|
||||
/**
|
||||
* @param string $userAgentString
|
||||
*/
|
||||
public function __construct($userAgentString = null)
|
||||
{
|
||||
if (null !== $userAgentString) {
|
||||
$this->setUserAgentString($userAgentString);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $userAgentString
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setUserAgentString($userAgentString)
|
||||
{
|
||||
$this->userAgentString = (string)$userAgentString;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUserAgentString()
|
||||
{
|
||||
if (null === $this->userAgentString) {
|
||||
$this->createUserAgentString();
|
||||
}
|
||||
|
||||
return $this->userAgentString;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function createUserAgentString()
|
||||
{
|
||||
$userAgentString = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
|
||||
$this->setUserAgentString($userAgentString);
|
||||
|
||||
return $userAgentString;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user