File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ class FileHandler implements CacheInterface
3838 * Mode for the stored files.
3939 * Must be chmod-safe (octal).
4040 *
41- * @var int
41+ * @var integer
4242 *
4343 * @see https://www.php.net/manual/en/function.chmod.php
4444 */
@@ -54,23 +54,24 @@ class FileHandler implements CacheInterface
5454 */
5555 public function __construct (Cache $ config )
5656 {
57- if (isset ($ config-> file ))
57+ if (! property_exists ($ config, ' file ' ))
5858 {
59- $ this ->path = $ config ->file ['storePath ' ] ?? WRITEPATH . 'cache ' ;
60- $ this ->mode = $ config ->file ['mode ' ] ?? 0640 ;
61- }
62- else
63- {
64- $ this ->path = ! empty ($ config ->storePath ) ? $ config ->storePath : WRITEPATH . 'cache ' ;
59+ $ config ->file = [
60+ 'storePath ' => $ config ->storePath ?? WRITEPATH . 'cache ' ,
61+ 'mode ' => 0640 ,
62+ ];
6563 }
6664
65+ $ this ->path = ! empty ($ config ->file ['storePath ' ]) ? $ config ->file ['storePath ' ] : WRITEPATH . 'cache ' ;
66+ $ this ->path = rtrim ($ this ->path , '/ ' ) . '/ ' ;
67+
6768 if (! is_really_writable ($ this ->path ))
6869 {
6970 throw CacheException::forUnableToWrite ($ this ->path );
7071 }
7172
73+ $ this ->mode = $ config ->file ['mode ' ] ?? 0640 ;
7274 $ this ->prefix = $ config ->prefix ?: '' ;
73- $ this ->path = rtrim ($ this ->path , '/ ' ) . '/ ' ;
7475 }
7576
7677 //--------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments