Skip to content

Commit

Permalink
Fix import mechanism
Browse files Browse the repository at this point in the history
Fix the case where importing datas and query the current agent in the
same request.

Also now it does not perform self analize before importing data.
  • Loading branch information
hisorange committed Dec 8, 2013
1 parent 0d5321c commit d523014
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "hisorange/browser-detect",
"description": "Browser & Mobile detection package for Laravel.",
"version": "0.9.1",
"version": "0.9.2",
"keywords": ["laravel", "user-agent", "browser", "mobile", "tablet", "user agent"],
"license": "MIT",
"authors": [
Expand Down
9 changes: 7 additions & 2 deletions src/hisorange/browserdetect/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Manager {
*
* @type array
*/
protected $results;
protected $results = array();

/**
* Key translations for Browscap.
Expand Down Expand Up @@ -119,7 +119,7 @@ public function getInfo()
}

// If the user agent not analized yet.
if ( ! isset($this->results[$this->ua])) {
if ( ! array_key_exists($this->ua, $this->results)) {
// Try to load it from the cache if allowed.
if (Config::get('browser-detect::cache', false)) {
// Generate cache key by prefix_md5_hashed_user_agent_string
Expand Down Expand Up @@ -353,6 +353,11 @@ protected function _mdFetcher($md, $list)
*/
public function __call($method, $params)
{
// Importing the info.
if (substr($method, 0, 6) == 'import') {
return new Info($params[0]);
}

$info = $this->getInfo();

// Check for browser data.
Expand Down

0 comments on commit d523014

Please sign in to comment.