-
Notifications
You must be signed in to change notification settings - Fork 0
Update FileStore.php #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,6 +11,11 @@ class FileStore implements StoreInterface { | |||||||||||||||||
| */ | ||||||||||||||||||
| protected $files; | ||||||||||||||||||
|
|
||||||||||||||||||
| /** | ||||||||||||||||||
| * Which app component use the cache | ||||||||||||||||||
| */ | ||||||||||||||||||
| protected $component; | ||||||||||||||||||
|
|
||||||||||||||||||
| /** | ||||||||||||||||||
| * The file cache directory | ||||||||||||||||||
| * | ||||||||||||||||||
|
|
@@ -50,6 +55,10 @@ public function get($key) | |||||||||||||||||
| */ | ||||||||||||||||||
| protected function getPayload($key) | ||||||||||||||||||
| { | ||||||||||||||||||
| if(!$key){ | ||||||||||||||||||
| throw new \Exception("Required parameter not has been set"); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
|
Comment on lines
+58
to
+61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Improve error handling in The current implementation has several issues:
Apply this diff to improve the error handling: - if(!$key){
- throw new \Exception("Required parameter not has been set");
- }
+ if (is_null($key)) {
+ throw new \Illuminate\Cache\InvalidArgumentException('Cache key must not be null.');
+ }Also consider:
📝 Committable suggestion
Suggested change
|
||||||||||||||||||
| $path = $this->path($key); | ||||||||||||||||||
|
|
||||||||||||||||||
| // If the file doesn't exists, we obviously can't return the cache so we will | ||||||||||||||||||
|
|
||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Improve documentation and implementation of the
$componentproperty.The property documentation and implementation have several issues:
@vartag and type informationApply this diff to improve the documentation:
Additionally:
📝 Committable suggestion