flagsmith-php-client
flagsmith-php-client copied to clipboard
Flagsmith instance clonning
Hi, clonning the instance with every configuration change is very expensive and not necessary in context of this library, I propose just setting the property and returning original object.
This also fixes Flagsmith.php line 183
public function withCache(?CacheInterface $cache): self
{
if (is_null($cache)) {
$this->with('cache', null); <-- result of this expression is not used anywhere (someone probably missed the clonning)
}
return $this->with(
'cache',
new Cache($cache, $this->cachePrefix, $this->timeToLive)
);
}