@@ -14,38 +14,38 @@ |
||
14 | 14 | class RedisCacheManager |
15 | 15 | { |
16 | 16 | |
17 | - /** @var Predis\Client */ |
|
18 | - private static $redis; |
|
17 | + /** @var Predis\Client */ |
|
18 | + private static $redis; |
|
19 | 19 | |
20 | - /** @param string $namespace */ |
|
21 | - private static $namespace; |
|
20 | + /** @param string $namespace */ |
|
21 | + private static $namespace; |
|
22 | 22 | |
23 | - /** |
|
24 | - * @return Client |
|
25 | - */ |
|
26 | - public static function connect() |
|
27 | - { |
|
23 | + /** |
|
24 | + * @return Client |
|
25 | + */ |
|
26 | + public static function connect() |
|
27 | + { |
|
28 | 28 | Autoloader::register(); |
29 | 29 | self::$redis = new Client([ |
30 | - 'scheme' => 'tcp', |
|
31 | - 'host' => REDIS_CONNECTION_CONFIG['REDIS_HOST'], |
|
32 | - 'port' => REDIS_CONNECTION_CONFIG['REDIS_PORT'], |
|
33 | - 'password' => REDIS_CONNECTION_CONFIG['REDIS_PASSWORD'], |
|
34 | - 'database' => 0 |
|
30 | + 'scheme' => 'tcp', |
|
31 | + 'host' => REDIS_CONNECTION_CONFIG['REDIS_HOST'], |
|
32 | + 'port' => REDIS_CONNECTION_CONFIG['REDIS_PORT'], |
|
33 | + 'password' => REDIS_CONNECTION_CONFIG['REDIS_PASSWORD'], |
|
34 | + 'database' => 0 |
|
35 | 35 | ]); |
36 | 36 | self::auth(); |
37 | 37 | self::$namespace = REDIS_CONNECTION_CONFIG['REDIS_NAMESPACE'] ?? 'Cache'; |
38 | 38 | return self::$redis; |
39 | - } |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * @return void |
|
43 | - */ |
|
44 | - private static function auth() |
|
45 | - { |
|
41 | + /** |
|
42 | + * @return void |
|
43 | + */ |
|
44 | + private static function auth() |
|
45 | + { |
|
46 | 46 | if(is_string(REDIS_CONNECTION_CONFIG['REDIS_PASSWORD']) && REDIS_CONNECTION_CONFIG['REDIS_PASSWORD'] !== '') { |
47 | - self::$redis->auth(REDIS_CONNECTION_CONFIG['REDIS_PASSWORD']); |
|
47 | + self::$redis->auth(REDIS_CONNECTION_CONFIG['REDIS_PASSWORD']); |
|
48 | + } |
|
48 | 49 | } |
49 | - } |
|
50 | 50 | |
51 | 51 | } |
@@ -13,91 +13,91 @@ |
||
13 | 13 | class TimeBuilder |
14 | 14 | { |
15 | 15 | |
16 | - /** @param string $unit */ |
|
17 | - private string $unit; |
|
16 | + /** @param string $unit */ |
|
17 | + private string $unit; |
|
18 | 18 | |
19 | - /** @param int $value */ |
|
20 | - private int $value; |
|
19 | + /** @param int $value */ |
|
20 | + private int $value; |
|
21 | 21 | |
22 | - /** @param Closure $callback */ |
|
23 | - private Closure $callback; |
|
22 | + /** @param Closure $callback */ |
|
23 | + private Closure $callback; |
|
24 | 24 | |
25 | - /** @param FileOptionBuilder */ |
|
26 | - private $builder = null; |
|
25 | + /** @param FileOptionBuilder */ |
|
26 | + private $builder = null; |
|
27 | 27 | |
28 | - public function __construct(Closure $callback, $builder) |
|
29 | - { |
|
28 | + public function __construct(Closure $callback, $builder) |
|
29 | + { |
|
30 | 30 | $this->callback = $callback; |
31 | 31 | $this->builder = $builder; |
32 | - } |
|
33 | - |
|
34 | - /** |
|
35 | - * @param int $value |
|
36 | - * @return FileOptionBuilder|mixed |
|
37 | - */ |
|
38 | - public function second(int $value) |
|
39 | - { |
|
32 | + } |
|
33 | + |
|
34 | + /** |
|
35 | + * @param int $value |
|
36 | + * @return FileOptionBuilder|mixed |
|
37 | + */ |
|
38 | + public function second(int $value) |
|
39 | + { |
|
40 | 40 | return $this->setTime($value, "seconds"); |
41 | - } |
|
42 | - |
|
43 | - /** |
|
44 | - * @param int $value |
|
45 | - * @return FileOptionBuilder|mixed |
|
46 | - */ |
|
47 | - public function minute(int $value) |
|
48 | - { |
|
41 | + } |
|
42 | + |
|
43 | + /** |
|
44 | + * @param int $value |
|
45 | + * @return FileOptionBuilder|mixed |
|
46 | + */ |
|
47 | + public function minute(int $value) |
|
48 | + { |
|
49 | 49 | return $this->setTime($value, "minutes"); |
50 | - } |
|
51 | - |
|
52 | - /** |
|
53 | - * @param int $value |
|
54 | - * @return FileOptionBuilder|mixed |
|
55 | - */ |
|
56 | - public function hour(int $value) |
|
57 | - { |
|
50 | + } |
|
51 | + |
|
52 | + /** |
|
53 | + * @param int $value |
|
54 | + * @return FileOptionBuilder|mixed |
|
55 | + */ |
|
56 | + public function hour(int $value) |
|
57 | + { |
|
58 | 58 | return $this->setTime($value, "hours"); |
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * @param int $value |
|
63 | - * @return FileOptionBuilder|mixed |
|
64 | - */ |
|
65 | - public function day(int $value) |
|
66 | - { |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * @param int $value |
|
63 | + * @return FileOptionBuilder|mixed |
|
64 | + */ |
|
65 | + public function day(int $value) |
|
66 | + { |
|
67 | 67 | return $this->setTime($value, "days"); |
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * @param int $value |
|
72 | - * @return FileOptionBuilder|mixed |
|
73 | - */ |
|
74 | - public function week(int $value) |
|
75 | - { |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * @param int $value |
|
72 | + * @return FileOptionBuilder|mixed |
|
73 | + */ |
|
74 | + public function week(int $value) |
|
75 | + { |
|
76 | 76 | return $this->setTime($value, "weeks"); |
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * @param int $value |
|
81 | - * @return FileOptionBuilder|mixed |
|
82 | - */ |
|
83 | - public function month(int $value) |
|
84 | - { |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * @param int $value |
|
81 | + * @return FileOptionBuilder|mixed |
|
82 | + */ |
|
83 | + public function month(int $value) |
|
84 | + { |
|
85 | 85 | return $this->setTime($value, "months"); |
86 | - } |
|
86 | + } |
|
87 | 87 | |
88 | 88 | |
89 | - /** |
|
90 | - * @param int $value |
|
91 | - * @param string $unit |
|
92 | - * @return FileOptionBuilder |
|
93 | - */ |
|
94 | - private function setTime(int $value, string $unit) |
|
95 | - { |
|
89 | + /** |
|
90 | + * @param int $value |
|
91 | + * @param string $unit |
|
92 | + * @return FileOptionBuilder |
|
93 | + */ |
|
94 | + private function setTime(int $value, string $unit) |
|
95 | + { |
|
96 | 96 | |
97 | 97 | $this->value = $value; |
98 | 98 | $this->unit = $unit; |
99 | - ($this->callback)("{$value} {$unit}"); |
|
99 | + ($this->callback)("{$value} {$unit}"); |
|
100 | 100 | return $this->builder; |
101 | - } |
|
101 | + } |
|
102 | 102 | |
103 | 103 | } |