Parser Class Reference
Inheritance diagram for Parser:
ParserInterface

Public Member Functions

 __construct (LoggerInterface $logger, IPInterface $ipHelper)
 
 account ()
 
 setUA ($ua)
 
 setIP ($ip)
 
 parse ()
 
 setCacheEnable ($set)
 
 setCacheSize ($size)
 
 clearCache ()
 
 setDataFile ($path)
 
 setAccessKey ($access_key)
 
 account ()
 
 parse ()
 
 setUA ($ua)
 
 setIP ($ip)
 
 setAccessKey ($access_key)
 
 setDataFile ($path)
 

Protected Member Functions

 setDBdat ()
 
 setCache ($key, $value)
 
 getCache ($key)
 

Protected Attributes

 $timeout = 60
 
 $api_url = 'http://api.udger.com/v3'
 
 $path
 
 $access_key
 
 $ip
 
 $ua
 
 $dbdat
 
 $ipHelper
 
 $cacheEnable = true
 
 $cache = array()
 
 $cacheSize = 3000
 

Detailed Description

Definition at line 21 of file Parser.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( LoggerInterface  $logger,
IPInterface  $ipHelper 
)
Parameters
LoggerInterface$logger
IPInterface

Definition at line 97 of file Parser.php.

Member Function Documentation

◆ account()

account ( )

Check your subscription

Returns
array

Implements ParserInterface.

Definition at line 108 of file Parser.php.

◆ clearCache()

clearCache ( )

Clear LRU cache

Returns
bool

Definition at line 631 of file Parser.php.

◆ getCache()

getCache (   $key)
protected

LRU cashe get

Definition at line 586 of file Parser.php.

◆ parse()

parse ( )

Parse the useragent string and/or IP

Returns
array

Implements ParserInterface.

Definition at line 171 of file Parser.php.

◆ setAccessKey()

setAccessKey (   $access_key)

Set the account access key

Parameters
string
Returns
bool

Implements ParserInterface.

Definition at line 661 of file Parser.php.

◆ setCache()

setCache (   $key,
  $value 
)
protected

LRU cashe set

Definition at line 575 of file Parser.php.

◆ setCacheEnable()

setCacheEnable (   $set)

Set LRU cache enable/disable

Parameters
bool
Returns
bool

Definition at line 606 of file Parser.php.

◆ setCacheSize()

setCacheSize (   $size)

Set LRU cache enable/disable

Parameters
Int
Returns
bool

Definition at line 620 of file Parser.php.

◆ setDataFile()

setDataFile (   $path)

Set path to sqlite file

Parameters
string
Returns
bool

Implements ParserInterface.

Definition at line 644 of file Parser.php.

◆ setDBdat()

setDBdat ( )
protected

Open DB file

Definition at line 564 of file Parser.php.

◆ setIP()

setIP (   $ip)

Set the IP address

Parameters
string
Returns
bool

Implements ParserInterface.

Definition at line 159 of file Parser.php.

◆ setUA()

setUA (   $ua)

Set the useragent string

Parameters
string
Returns
bool

Implements ParserInterface.

Definition at line 146 of file Parser.php.

Field Documentation

◆ $access_key

$access_key
protected

Personal access key

@type string

Definition at line 50 of file Parser.php.

◆ $api_url

$api_url = 'http://api.udger.com/v3'
protected

Api URL

@type string

Definition at line 36 of file Parser.php.

◆ $cache

$cache = array()
protected

@array LRU cache

Definition at line 86 of file Parser.php.

◆ $cacheEnable

$cacheEnable = true
protected

@boolean LRU cache enable/disable

Definition at line 81 of file Parser.php.

◆ $cacheSize

$cacheSize = 3000
protected

@int LRU cache size

Definition at line 91 of file Parser.php.

◆ $dbdat

$dbdat
protected

DB link

@type object

Definition at line 71 of file Parser.php.

◆ $ip

$ip
protected

IP address for parse

@type string

Definition at line 57 of file Parser.php.

◆ $ipHelper

$ipHelper
protected

Definition at line 76 of file Parser.php.

◆ $path

$path
protected

Path to the data file

@type string

Definition at line 43 of file Parser.php.

◆ $timeout

$timeout = 60
protected

Default timeout for network requests

@type integer

Definition at line 29 of file Parser.php.

◆ $ua

$ua
protected

Useragent string for parse

@type string

Definition at line 64 of file Parser.php.