Skip to content

Commit 019a20f

Browse files
authored
Merge pull request #34 from bigcommerce/arrayservicecacheoptimisation
Micro-optimisation in ArrayServiceCache::get() and ArrayServiceCache::remove()
2 parents d97e3cf + f21da4f commit 019a20f

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

src/Cache/ArrayServiceCache.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ public function __construct(array $values = [])
3131
*/
3232
public function get(string $key): mixed
3333
{
34-
if (!isset($this->values[$key])) {
35-
return false;
36-
}
37-
return $this->values[$key];
34+
return $this->values[$key] ?? false;
3835
}
3936

4037
/**
@@ -57,9 +54,6 @@ public function set(string $key, mixed $value): void
5754
*/
5855
public function remove(string $key): void
5956
{
60-
if (!isset($this->values[$key])) {
61-
return;
62-
}
6357
unset($this->values[$key]);
6458
}
6559

0 commit comments

Comments
 (0)