@@ -53,24 +53,24 @@ |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
56 | - * Converts the exception to a JSON serializable format. |
|
57 | - * |
|
58 | - * @return string |
|
59 | - */ |
|
56 | + * Converts the exception to a JSON serializable format. |
|
57 | + * |
|
58 | + * @return string |
|
59 | + */ |
|
60 | 60 | public function jsonSerialize(): array |
61 | 61 | { |
62 | 62 | return parent::jsonSerialize(); |
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
66 | - * Converts the exception to a JSON string. |
|
67 | - * |
|
68 | - * @param int $options |
|
69 | - * @return string |
|
70 | - */ |
|
66 | + * Converts the exception to a JSON string. |
|
67 | + * |
|
68 | + * @param int $options |
|
69 | + * @return string |
|
70 | + */ |
|
71 | 71 | public function toJson(int $options = 0) |
72 | 72 | { |
73 | - return parent::toJson($options); |
|
73 | + return parent::toJson($options); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 |
@@ -53,23 +53,23 @@ |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
56 | - * Converts the exception to a JSON serializable format. |
|
57 | - * |
|
58 | - * @return string |
|
59 | - */ |
|
56 | + * Converts the exception to a JSON serializable format. |
|
57 | + * |
|
58 | + * @return string |
|
59 | + */ |
|
60 | 60 | public function jsonSerialize(): array |
61 | 61 | { |
62 | 62 | return parent::jsonSerialize(); |
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
66 | - * Converts the exception to a JSON string. |
|
67 | - * |
|
68 | - * @param int $options |
|
69 | - * @return string |
|
70 | - */ |
|
66 | + * Converts the exception to a JSON string. |
|
67 | + * |
|
68 | + * @param int $options |
|
69 | + * @return string |
|
70 | + */ |
|
71 | 71 | public function toJson(int $options = 0) |
72 | 72 | { |
73 | - return parent::toJson($options); |
|
73 | + return parent::toJson($options); |
|
74 | 74 | } |
75 | 75 | } |
@@ -14,11 +14,11 @@ discard block |
||
14 | 14 | { |
15 | 15 | |
16 | 16 | /** |
17 | - * Converts a string expiration format to seconds. |
|
18 | - * |
|
19 | - * @param string $expiration |
|
20 | - * @return int |
|
21 | - */ |
|
17 | + * Converts a string expiration format to seconds. |
|
18 | + * |
|
19 | + * @param string $expiration |
|
20 | + * @return int |
|
21 | + */ |
|
22 | 22 | public static function convertExpirationToSeconds(string $expiration) |
23 | 23 | { |
24 | 24 | $units = [ |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
42 | - * Merges cache data with existing data. |
|
43 | - * |
|
44 | - * @param array $options |
|
45 | - * @return array |
|
46 | - */ |
|
42 | + * Merges cache data with existing data. |
|
43 | + * |
|
44 | + * @param array $options |
|
45 | + * @return array |
|
46 | + */ |
|
47 | 47 | public static function mergeCacheData($cacheData) |
48 | 48 | { |
49 | 49 | return CacheerHelper::mergeCacheData($cacheData); |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
67 | - * Calculates the TTL (Time To Live) for cache items. |
|
68 | - * |
|
69 | - * @param string|int $ttl |
|
70 | - * @param int $defaultTTL |
|
71 | - * @return mixed |
|
72 | - */ |
|
67 | + * Calculates the TTL (Time To Live) for cache items. |
|
68 | + * |
|
69 | + * @param string|int $ttl |
|
70 | + * @param int $defaultTTL |
|
71 | + * @return mixed |
|
72 | + */ |
|
73 | 73 | public static function ttl($ttl = null, ?int $defaultTTL = null) { |
74 | 74 | if ($ttl) { |
75 | 75 | $ttl = is_string($ttl) ? self::convertExpirationToSeconds($ttl) : $ttl; |
@@ -79,15 +79,15 @@ discard block |
||
79 | 79 | return $ttl; |
80 | 80 | } |
81 | 81 | |
82 | - /** |
|
83 | - * Generates an array identifier for cache data. |
|
84 | - * |
|
85 | - * @param mixed $currentCacheData |
|
86 | - * @param mixed $cacheData |
|
87 | - * @return array |
|
88 | - */ |
|
89 | - public static function arrayIdentifier(mixed $currentCacheData, mixed $cacheData) |
|
90 | - { |
|
82 | + /** |
|
83 | + * Generates an array identifier for cache data. |
|
84 | + * |
|
85 | + * @param mixed $currentCacheData |
|
86 | + * @param mixed $cacheData |
|
87 | + * @return array |
|
88 | + */ |
|
89 | + public static function arrayIdentifier(mixed $currentCacheData, mixed $cacheData) |
|
90 | + { |
|
91 | 91 | return CacheerHelper::arrayIdentifier($currentCacheData, $cacheData); |
92 | - } |
|
92 | + } |
|
93 | 93 | } |
@@ -12,24 +12,24 @@ discard block |
||
12 | 12 | { |
13 | 13 | |
14 | 14 | /** |
15 | - * Gets the path to the SQLite database file. |
|
16 | - * |
|
17 | - * @param string $database |
|
18 | - * @param ?string $path |
|
19 | - * @return string |
|
20 | - */ |
|
15 | + * Gets the path to the SQLite database file. |
|
16 | + * |
|
17 | + * @param string $database |
|
18 | + * @param ?string $path |
|
19 | + * @return string |
|
20 | + */ |
|
21 | 21 | public static function database(string $database = 'database.sqlite', ?string $path = null) |
22 | 22 | { |
23 | 23 | return self::getDynamicSqliteDbPath($database, $path); |
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
27 | - * Gets the path to the SQLite database file dynamically. |
|
28 | - * |
|
29 | - * @param string $database |
|
30 | - * @param ?string $path |
|
31 | - * @return string |
|
32 | - */ |
|
27 | + * Gets the path to the SQLite database file dynamically. |
|
28 | + * |
|
29 | + * @param string $database |
|
30 | + * @param ?string $path |
|
31 | + * @return string |
|
32 | + */ |
|
33 | 33 | private static function getDynamicSqliteDbPath(string $database, ?string $path = null) |
34 | 34 | { |
35 | 35 | $rootPath = EnvHelper::getRootPath(); |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | - * Creates the database directory if it does not exist. |
|
51 | - * |
|
52 | - * @param string $databaseDir |
|
53 | - * @return void |
|
54 | - */ |
|
50 | + * Creates the database directory if it does not exist. |
|
51 | + * |
|
52 | + * @param string $databaseDir |
|
53 | + * @return void |
|
54 | + */ |
|
55 | 55 | private static function createDatabaseDir(string $databaseDir) |
56 | 56 | { |
57 | 57 | if (!is_dir($databaseDir)) { |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | - * Creates the SQLite database file if it does not exist. |
|
64 | - * |
|
65 | - * @param string $dbFile |
|
66 | - * @return void |
|
67 | - */ |
|
63 | + * Creates the SQLite database file if it does not exist. |
|
64 | + * |
|
65 | + * @param string $dbFile |
|
66 | + * @return void |
|
67 | + */ |
|
68 | 68 | private static function createDatabaseFile(string $dbFile) |
69 | 69 | { |
70 | 70 | if (!file_exists($dbFile)) { |
@@ -73,12 +73,12 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
76 | - * Checks if the database name has the correct extension. |
|
77 | - * If not, appends '.sqlite' to the name. |
|
78 | - * |
|
79 | - * @param string $database |
|
80 | - * @return string |
|
81 | - */ |
|
76 | + * Checks if the database name has the correct extension. |
|
77 | + * If not, appends '.sqlite' to the name. |
|
78 | + * |
|
79 | + * @param string $database |
|
80 | + * @return string |
|
81 | + */ |
|
82 | 82 | private static function checkExtension(string $database) |
83 | 83 | { |
84 | 84 | if (strpos($database, '.sqlite') === false) { |
@@ -23,61 +23,61 @@ discard block |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
26 | - * Logs a info message. |
|
27 | - * |
|
28 | - * @return void |
|
29 | - */ |
|
26 | + * Logs a info message. |
|
27 | + * |
|
28 | + * @return void |
|
29 | + */ |
|
30 | 30 | public function info($message) |
31 | 31 | { |
32 | 32 | $this->log('INFO', $message); |
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
36 | - * Logs a warning message. |
|
37 | - * |
|
38 | - * @return void |
|
39 | - */ |
|
36 | + * Logs a warning message. |
|
37 | + * |
|
38 | + * @return void |
|
39 | + */ |
|
40 | 40 | public function warning($message) |
41 | 41 | { |
42 | 42 | $this->log('WARNING', $message); |
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
46 | - * Logs an error message. |
|
47 | - * |
|
48 | - * @return void |
|
49 | - */ |
|
46 | + * Logs an error message. |
|
47 | + * |
|
48 | + * @return void |
|
49 | + */ |
|
50 | 50 | public function error($message) |
51 | 51 | { |
52 | 52 | $this->log('ERROR', $message); |
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
56 | - * Logs a debug message. |
|
57 | - * |
|
58 | - * @return void |
|
59 | - */ |
|
56 | + * Logs a debug message. |
|
57 | + * |
|
58 | + * @return void |
|
59 | + */ |
|
60 | 60 | public function debug($message) |
61 | 61 | { |
62 | 62 | $this->log('DEBUG', $message); |
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
66 | - * Checks if the log level is sufficient to log the message. |
|
67 | - * |
|
68 | - * @param mixed $level |
|
69 | - * @return string|int|false |
|
70 | - */ |
|
66 | + * Checks if the log level is sufficient to log the message. |
|
67 | + * |
|
68 | + * @param mixed $level |
|
69 | + * @return string|int|false |
|
70 | + */ |
|
71 | 71 | private function shouldLog(mixed $level) |
72 | 72 | { |
73 | 73 | return array_search($level, $this->logLevels) >= array_search($this->logLevel, $this->logLevels); |
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
77 | - * Rotates the log file if it exceeds the maximum size. |
|
78 | - * |
|
79 | - * @return void |
|
80 | - */ |
|
77 | + * Rotates the log file if it exceeds the maximum size. |
|
78 | + * |
|
79 | + * @return void |
|
80 | + */ |
|
81 | 81 | private function rotateLog() |
82 | 82 | { |
83 | 83 | if (file_exists($this->logFile) && filesize($this->logFile) >= $this->maxFileSize) { |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
90 | - * Logs a message to the log file. |
|
91 | - * |
|
92 | - * @param mixed $level |
|
93 | - * @param string $message |
|
94 | - * @return void |
|
95 | - */ |
|
90 | + * Logs a message to the log file. |
|
91 | + * |
|
92 | + * @param mixed $level |
|
93 | + * @param string $message |
|
94 | + * @return void |
|
95 | + */ |
|
96 | 96 | private function log($level, $message) |
97 | 97 | { |
98 | 98 | if (!$this->shouldLog($level)) { |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | { |
21 | 21 | |
22 | 22 | /** |
23 | - * @var Cacheer |
|
24 | - */ |
|
23 | + * @var Cacheer |
|
24 | + */ |
|
25 | 25 | protected $cacheer; |
26 | 26 | |
27 | 27 | /** @param string $logPath */ |
@@ -38,10 +38,10 @@ discard block |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
41 | - * Uses the database driver for caching. |
|
42 | - * |
|
43 | - * @return Cacheer |
|
44 | - */ |
|
41 | + * Uses the database driver for caching. |
|
42 | + * |
|
43 | + * @return Cacheer |
|
44 | + */ |
|
45 | 45 | public function useDatabaseDriver() |
46 | 46 | { |
47 | 47 | $this->cacheer->cacheStore = new DatabaseCacheStore($this->logPath); |
@@ -49,10 +49,10 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
52 | - * Uses the file driver for caching. |
|
53 | - * |
|
54 | - * @return Cacheer |
|
55 | - */ |
|
52 | + * Uses the file driver for caching. |
|
53 | + * |
|
54 | + * @return Cacheer |
|
55 | + */ |
|
56 | 56 | public function useFileDriver() |
57 | 57 | { |
58 | 58 | $this->cacheer->options['loggerPath'] = $this->logPath; |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
64 | - * Uses the Redis driver for caching. |
|
65 | - * |
|
66 | - * @return Cacheer |
|
67 | - */ |
|
64 | + * Uses the Redis driver for caching. |
|
65 | + * |
|
66 | + * @return Cacheer |
|
67 | + */ |
|
68 | 68 | public function useRedisDriver() |
69 | 69 | { |
70 | 70 | $this->cacheer->cacheStore = new RedisCacheStore($this->logPath); |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
75 | - * Uses the array driver for caching. |
|
76 | - * |
|
77 | - * @return Cacheer |
|
78 | - */ |
|
75 | + * Uses the array driver for caching. |
|
76 | + * |
|
77 | + * @return Cacheer |
|
78 | + */ |
|
79 | 79 | public function useArrayDriver() |
80 | 80 | { |
81 | 81 | $this->cacheer->cacheStore = new ArrayCacheStore($this->logPath); |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
86 | - * Uses the default driver for caching. |
|
87 | - * |
|
88 | - * @return Cacheer |
|
89 | - */ |
|
86 | + * Uses the default driver for caching. |
|
87 | + * |
|
88 | + * @return Cacheer |
|
89 | + */ |
|
90 | 90 | public function useDefaultDriver() |
91 | 91 | { |
92 | 92 | if (!isset($this->cacheer->options['cacheDir'])) { |
@@ -103,16 +103,16 @@ discard block |
||
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
106 | - * Checks if the directory exists or creates it. |
|
107 | - * |
|
108 | - * @param mixed $dirName |
|
109 | - * @return bool |
|
110 | - */ |
|
106 | + * Checks if the directory exists or creates it. |
|
107 | + * |
|
108 | + * @param mixed $dirName |
|
109 | + * @return bool |
|
110 | + */ |
|
111 | 111 | private function isDir(mixed $dirName) |
112 | 112 | { |
113 | - if (is_dir($dirName)) { |
|
114 | - return true; |
|
115 | - } |
|
116 | - return mkdir($dirName, 0755, true); |
|
113 | + if (is_dir($dirName)) { |
|
114 | + return true; |
|
115 | + } |
|
116 | + return mkdir($dirName, 0755, true); |
|
117 | 117 | } |
118 | 118 | } |
@@ -13,20 +13,20 @@ discard block |
||
13 | 13 | private mixed $data; |
14 | 14 | |
15 | 15 | /** |
16 | - * CacheDataFormatter constructor. |
|
17 | - * |
|
18 | - * @param mixed $data |
|
19 | - */ |
|
16 | + * CacheDataFormatter constructor. |
|
17 | + * |
|
18 | + * @param mixed $data |
|
19 | + */ |
|
20 | 20 | public function __construct(mixed $data) |
21 | 21 | { |
22 | 22 | $this->data = $data; |
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
26 | - * Converts the data to JSON format. |
|
27 | - * |
|
28 | - * @return string|false |
|
29 | - */ |
|
26 | + * Converts the data to JSON format. |
|
27 | + * |
|
28 | + * @return string|false |
|
29 | + */ |
|
30 | 30 | public function toJson() |
31 | 31 | { |
32 | 32 | return json_encode( |
@@ -38,30 +38,30 @@ discard block |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
41 | - * Converts the data to an array. |
|
42 | - * |
|
43 | - * @return array |
|
44 | - */ |
|
41 | + * Converts the data to an array. |
|
42 | + * |
|
43 | + * @return array |
|
44 | + */ |
|
45 | 45 | public function toArray() |
46 | 46 | { |
47 | 47 | return (array)$this->data; |
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
51 | - * Converts the data to a string. |
|
52 | - * |
|
53 | - * @return string |
|
54 | - */ |
|
51 | + * Converts the data to a string. |
|
52 | + * |
|
53 | + * @return string |
|
54 | + */ |
|
55 | 55 | public function toString() |
56 | 56 | { |
57 | 57 | return (string)$this->data; |
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
61 | - * Converts the data to an object. |
|
62 | - * |
|
63 | - * @return object |
|
64 | - */ |
|
61 | + * Converts the data to an object. |
|
62 | + * |
|
63 | + * @return object |
|
64 | + */ |
|
65 | 65 | public function toObject() |
66 | 66 | { |
67 | 67 | return (object)$this->data; |
@@ -13,112 +13,112 @@ |
||
13 | 13 | class TimeBuilder |
14 | 14 | { |
15 | 15 | |
16 | - /** @param string $unit */ |
|
17 | - private string $unit; |
|
18 | - |
|
19 | - /** @param int $value */ |
|
20 | - private int $value; |
|
21 | - |
|
22 | - /** @param Closure $callback */ |
|
23 | - private Closure $callback; |
|
24 | - |
|
25 | - /** @param FileOptionBuilder */ |
|
26 | - private $builder = null; |
|
27 | - |
|
28 | - /** |
|
29 | - * TimeBuilder constructor. |
|
30 | - * @param Closure $callback |
|
31 | - * @param FileOptionBuilder $builder |
|
32 | - * |
|
33 | - * @return void |
|
34 | - */ |
|
35 | - public function __construct(Closure $callback, $builder) |
|
36 | - { |
|
16 | + /** @param string $unit */ |
|
17 | + private string $unit; |
|
18 | + |
|
19 | + /** @param int $value */ |
|
20 | + private int $value; |
|
21 | + |
|
22 | + /** @param Closure $callback */ |
|
23 | + private Closure $callback; |
|
24 | + |
|
25 | + /** @param FileOptionBuilder */ |
|
26 | + private $builder = null; |
|
27 | + |
|
28 | + /** |
|
29 | + * TimeBuilder constructor. |
|
30 | + * @param Closure $callback |
|
31 | + * @param FileOptionBuilder $builder |
|
32 | + * |
|
33 | + * @return void |
|
34 | + */ |
|
35 | + public function __construct(Closure $callback, $builder) |
|
36 | + { |
|
37 | 37 | $this->callback = $callback; |
38 | 38 | $this->builder = $builder; |
39 | - } |
|
40 | - |
|
41 | - /** |
|
42 | - * Sets the time in seconds. |
|
43 | - * |
|
44 | - * @param int $seconds |
|
45 | - * @return FileOptionBuilder|mixed |
|
46 | - */ |
|
47 | - public function second(int $seconds) |
|
48 | - { |
|
39 | + } |
|
40 | + |
|
41 | + /** |
|
42 | + * Sets the time in seconds. |
|
43 | + * |
|
44 | + * @param int $seconds |
|
45 | + * @return FileOptionBuilder|mixed |
|
46 | + */ |
|
47 | + public function second(int $seconds) |
|
48 | + { |
|
49 | 49 | return $this->setTime($seconds, "seconds"); |
50 | - } |
|
51 | - |
|
52 | - /** |
|
53 | - * Sets the time in minutes. |
|
54 | - * |
|
55 | - * @param int $minutes |
|
56 | - * @return FileOptionBuilder|mixed |
|
57 | - */ |
|
58 | - public function minute(int $minutes) |
|
59 | - { |
|
50 | + } |
|
51 | + |
|
52 | + /** |
|
53 | + * Sets the time in minutes. |
|
54 | + * |
|
55 | + * @param int $minutes |
|
56 | + * @return FileOptionBuilder|mixed |
|
57 | + */ |
|
58 | + public function minute(int $minutes) |
|
59 | + { |
|
60 | 60 | return $this->setTime($minutes, "minutes"); |
61 | - } |
|
62 | - |
|
63 | - /** |
|
64 | - * Sets the time in hours. |
|
65 | - * |
|
66 | - * @param int $hours |
|
67 | - * @return FileOptionBuilder|mixed |
|
68 | - */ |
|
69 | - public function hour(int $hours) |
|
70 | - { |
|
61 | + } |
|
62 | + |
|
63 | + /** |
|
64 | + * Sets the time in hours. |
|
65 | + * |
|
66 | + * @param int $hours |
|
67 | + * @return FileOptionBuilder|mixed |
|
68 | + */ |
|
69 | + public function hour(int $hours) |
|
70 | + { |
|
71 | 71 | return $this->setTime($hours, "hours"); |
72 | - } |
|
73 | - |
|
74 | - /** |
|
75 | - * Sets the time in days. |
|
76 | - * |
|
77 | - * @param int $days |
|
78 | - * @return FileOptionBuilder|mixed |
|
79 | - */ |
|
80 | - public function day(int $days) |
|
81 | - { |
|
72 | + } |
|
73 | + |
|
74 | + /** |
|
75 | + * Sets the time in days. |
|
76 | + * |
|
77 | + * @param int $days |
|
78 | + * @return FileOptionBuilder|mixed |
|
79 | + */ |
|
80 | + public function day(int $days) |
|
81 | + { |
|
82 | 82 | return $this->setTime($days, "days"); |
83 | - } |
|
84 | - |
|
85 | - /** |
|
86 | - * Sets the time in weeks. |
|
87 | - * |
|
88 | - * @param int $weeks |
|
89 | - * @return FileOptionBuilder|mixed |
|
90 | - */ |
|
91 | - public function week(int $weeks) |
|
92 | - { |
|
83 | + } |
|
84 | + |
|
85 | + /** |
|
86 | + * Sets the time in weeks. |
|
87 | + * |
|
88 | + * @param int $weeks |
|
89 | + * @return FileOptionBuilder|mixed |
|
90 | + */ |
|
91 | + public function week(int $weeks) |
|
92 | + { |
|
93 | 93 | return $this->setTime($weeks, "weeks"); |
94 | - } |
|
95 | - |
|
96 | - /** |
|
97 | - * Sets the time in months. |
|
98 | - * |
|
99 | - * @param int $months |
|
100 | - * @return FileOptionBuilder|mixed |
|
101 | - */ |
|
102 | - public function month(int $months) |
|
103 | - { |
|
94 | + } |
|
95 | + |
|
96 | + /** |
|
97 | + * Sets the time in months. |
|
98 | + * |
|
99 | + * @param int $months |
|
100 | + * @return FileOptionBuilder|mixed |
|
101 | + */ |
|
102 | + public function month(int $months) |
|
103 | + { |
|
104 | 104 | return $this->setTime($months, "months"); |
105 | - } |
|
105 | + } |
|
106 | 106 | |
107 | 107 | |
108 | - /** |
|
109 | - * This method sets the time value and unit, and invokes the callback with the formatted string. |
|
110 | - * |
|
111 | - * @param int $value |
|
112 | - * @param string $unit |
|
113 | - * @return FileOptionBuilder |
|
114 | - */ |
|
115 | - private function setTime(int $value, string $unit) |
|
116 | - { |
|
108 | + /** |
|
109 | + * This method sets the time value and unit, and invokes the callback with the formatted string. |
|
110 | + * |
|
111 | + * @param int $value |
|
112 | + * @param string $unit |
|
113 | + * @return FileOptionBuilder |
|
114 | + */ |
|
115 | + private function setTime(int $value, string $unit) |
|
116 | + { |
|
117 | 117 | |
118 | 118 | $this->value = $value; |
119 | 119 | $this->unit = $unit; |
120 | - ($this->callback)("{$value} {$unit}"); |
|
120 | + ($this->callback)("{$value} {$unit}"); |
|
121 | 121 | return $this->builder; |
122 | - } |
|
122 | + } |
|
123 | 123 | |
124 | 124 | } |
@@ -43,18 +43,18 @@ |
||
43 | 43 | |
44 | 44 | |
45 | 45 | /** |
46 | - * @var CacheLogger |
|
47 | - */ |
|
46 | + * @var CacheLogger |
|
47 | + */ |
|
48 | 48 | private $logger = null; |
49 | 49 | |
50 | 50 | /** |
51 | - * @var FileCacheManager |
|
52 | - */ |
|
51 | + * @var FileCacheManager |
|
52 | + */ |
|
53 | 53 | private FileCacheManager $fileManager; |
54 | 54 | |
55 | 55 | /** |
56 | - * @var FileCacheFlusher |
|
57 | - */ |
|
56 | + * @var FileCacheFlusher |
|
57 | + */ |
|
58 | 58 | private FileCacheFlusher $flusher; |
59 | 59 | |
60 | 60 |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | * @param string|int $ttl |
179 | 179 | * @return string |
180 | 180 | */ |
181 | - public function getCache(string $cacheKey, string $namespace = '', string|int $ttl = 3600) |
|
181 | + public function getCache(string $cacheKey, string $namespace = '', string | int $ttl = 3600) |
|
182 | 182 | { |
183 | 183 | |
184 | 184 | $ttl = CacheFileHelper::ttl($ttl, $this->defaultTTL); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | * @param string|int $ttl |
264 | 264 | * @return mixed |
265 | 265 | */ |
266 | - public function getMany(array $cacheKeys, string $namespace = '', string|int $ttl = 3600) |
|
266 | + public function getMany(array $cacheKeys, string $namespace = '', string | int $ttl = 3600) |
|
267 | 267 | { |
268 | 268 | $ttl = CacheFileHelper::ttl($ttl, $this->defaultTTL); |
269 | 269 | $results = []; |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * @param string|int $ttl |
310 | 310 | * @return void |
311 | 311 | */ |
312 | - public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', string|int $ttl = 3600) |
|
312 | + public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', string | int $ttl = 3600) |
|
313 | 313 | { |
314 | 314 | $cacheFile = $this->buildCacheFilePath($cacheKey, $namespace); |
315 | 315 | $data = $this->fileManager->serialize($cacheData); |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | * @param string $namespace |
347 | 347 | * @return void |
348 | 348 | */ |
349 | - public function renewCache(string $cacheKey, string|int $ttl, string $namespace = '') |
|
349 | + public function renewCache(string $cacheKey, string | int $ttl, string $namespace = '') |
|
350 | 350 | { |
351 | 351 | $cacheData = $this->getCache($cacheKey, $namespace); |
352 | 352 | if ($cacheData) { |