Skip to content

Commit

Permalink
Restructured some code on the FileSystemCacheItemPool
Browse files Browse the repository at this point in the history
  • Loading branch information
Hectorhammett committed May 8, 2024
1 parent c8dfc32 commit 55482c3
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/Cache/FileSystemCacheItemPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ public function __construct($options = [])
}

if (is_dir($this->cachePath)) {
return true;
return;
}

if (!mkdir($this->cachePath)) {
throw new ErrorException("Cache folde couldn't be created");
throw new ErrorException("Cache folder couldn't be created");
}
}

Expand Down Expand Up @@ -65,10 +65,6 @@ public function getItems(array $keys = []): iterable
$result = [];

foreach ($keys as $key) {
if ($this->isValidKey($key)){
throw new InvalidArgumentException("The key '$key' is not valid. The key should follow the pattern |^[a-zA-Z0-9_\.! ]+$|");
}

$result[$key] = $this->getItem($key);
}

Expand All @@ -86,7 +82,7 @@ public function hasItem(string $key): bool
return false;
}

$serializedItem = file_get_contents($this->cacheFilePath($key));
$serializedItem = file_get_contents($itemPath);
return unserialize($serializedItem)->isHit();

Check failure on line 86 in src/Cache/FileSystemCacheItemPool.php

View workflow job for this annotation

GitHub Actions / PHPStan Static Analysis

Parameter #1 $data of function unserialize expects string, string|false given.
}

Expand Down

0 comments on commit 55482c3

Please sign in to comment.