Skip to content

Commit

Permalink
Make Plugins group test 1 minute faster on my box!
Browse files Browse the repository at this point in the history
  • Loading branch information
mattab committed Dec 8, 2013
1 parent ef9b065 commit 49e77d9
Showing 1 changed file with 24 additions and 4 deletions.
Expand Up @@ -14,7 +14,15 @@

class UserAgentParserEnhanced
{
public static $deviceTypes = array('desktop', 'smartphone', 'tablet', 'feature phone', 'console', 'tv', 'car browser');
public static $deviceTypes = array(
'desktop',
'smartphone',
'tablet',
'feature phone',
'console',
'tv',
'car browser'
);

public static $deviceBrands = array(
'AC' => 'Acer',
Expand Down Expand Up @@ -335,17 +343,29 @@ public function __construct($userAgent)

protected function getOsRegexes()
{
return Spyc::YAMLLoad(dirname(__FILE__) . self::$regexesDir . self::$osRegexesFile);
static $regexOs = null;
if(empty($regexOs)) {
$regexOs = Spyc::YAMLLoad(dirname(__FILE__) . self::$regexesDir . self::$osRegexesFile);
}
return $regexOs;
}

protected function getBrowserRegexes()
{
return Spyc::YAMLLoad(dirname(__FILE__) . self::$regexesDir . self::$browserRegexesFile);
static $regexBrowser = null;
if(empty($regexBrowser)) {
$regexBrowser = Spyc::YAMLLoad(dirname(__FILE__) . self::$regexesDir . self::$browserRegexesFile);
}
return $regexBrowser;
}

protected function getMobileRegexes()
{
return Spyc::YAMLLoad(dirname(__FILE__) . self::$regexesDir . self::$mobileRegexesFile);
static $regexMobile = null;
if(empty($regexMobile)) {
$regexMobile = Spyc::YAMLLoad(dirname(__FILE__) . self::$regexesDir . self::$mobileRegexesFile);
}
return $regexMobile;
}

public function parse()
Expand Down

0 comments on commit 49e77d9

Please sign in to comment.