Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Ensure to use correct cache for client hints parsing #7329

Merged
merged 1 commit into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Parser/Client/Browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

namespace DeviceDetector\Parser\Client;

use DeviceDetector\Cache\CacheInterface;
use DeviceDetector\ClientHints;
use DeviceDetector\Parser\Client\Browser\Engine;
use DeviceDetector\Parser\Client\Hints\BrowserHints;
Expand Down Expand Up @@ -663,6 +664,17 @@ public function setUserAgent(string $ua): void
$this->browserHints->setUserAgent($ua);
}

/**
* Sets the Cache class
*
* @param CacheInterface $cache
*/
public function setCache(CacheInterface $cache): void
{
parent::setCache($cache);
$this->browserHints->setCache($cache);
}

/**
* Returns list of all available browsers
* @return array
Expand Down
12 changes: 12 additions & 0 deletions Parser/Client/MobileApp.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

namespace DeviceDetector\Parser\Client;

use DeviceDetector\Cache\CacheInterface;
use DeviceDetector\ClientHints;
use DeviceDetector\Parser\Client\Hints\AppHints;

Expand Down Expand Up @@ -71,6 +72,17 @@ public function setUserAgent(string $ua): void
$this->appHints->setUserAgent($ua);
}

/**
* Sets the Cache class
*
* @param CacheInterface $cache
*/
public function setCache(CacheInterface $cache): void
{
parent::setCache($cache);
$this->appHints->setCache($cache);
}

/**
* Parses the current UA and checks whether it contains any client information
* See parent::parse() for more details.
Expand Down