Passed
Push — master ( 46bc3b...8d91f6 )
by Aleksei
35:20 queued 22:02
created
src/Cache/src/CacheRepository.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         protected CacheInterface $storage,
26 26
         protected ?EventDispatcherInterface $dispatcher = null,
27 27
         protected ?string $prefix = null,
28
-    ) {}
28
+    ){}
29 29
 
30 30
     public function get(string $key, mixed $default = null): mixed
31 31
     {
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 
36 36
         $value = $this->storage->get($key);
37 37
 
38
-        if ($value === null) {
38
+        if ($value === null){
39 39
             $this->dispatcher?->dispatch(new CacheMissed($key));
40 40
 
41 41
             return $default;
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         return $value;
47 47
     }
48 48
 
49
-    public function set(string $key, mixed $value, \DateInterval|int|null $ttl = null): bool
49
+    public function set(string $key, mixed $value, \DateInterval | int | null $ttl = null): bool
50 50
     {
51 51
         $key = $this->resolveKey($key);
52 52
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     {
90 90
         $array = [];
91 91
         // Resolve keys and dispatch events
92
-        foreach ($keys as $key) {
92
+        foreach ($keys as $key){
93 93
             $key = $this->resolveKey($key);
94 94
             $this->dispatcher?->dispatch(new CacheRetrieving($key));
95 95
             // Fill resulting array with default values
@@ -99,16 +99,16 @@  discard block
 block discarded – undo
99 99
         // If no dispatcher is set, we can skip the loop with events
100 100
         // to save some CPU cycles
101 101
         $keys = \array_keys($array);
102
-        if ($this->dispatcher === null) {
102
+        if ($this->dispatcher === null){
103 103
             return $this->storage->getMultiple($keys, $default);
104 104
         }
105 105
 
106 106
         $result = $this->storage->getMultiple($keys);
107 107
 
108
-        foreach ($result as $key => $value) {
109
-            if ($value === null) {
108
+        foreach ($result as $key => $value){
109
+            if ($value === null){
110 110
                 $this->dispatcher->dispatch(new CacheMissed($key));
111
-            } else {
111
+            }else{
112 112
                 // Replace default value with actual value in the resulting array
113 113
                 $array[$key] = $value;
114 114
                 $this->dispatcher->dispatch(new CacheHit($key, $value));
@@ -118,12 +118,12 @@  discard block
 block discarded – undo
118 118
         return $array;
119 119
     }
120 120
 
121
-    public function setMultiple(iterable $values, \DateInterval|int|null $ttl = null): bool
121
+    public function setMultiple(iterable $values, \DateInterval | int | null $ttl = null): bool
122 122
     {
123 123
         $dispatcher = $this->dispatcher;
124 124
         $array = [];
125 125
         // Resolve keys and dispatch events
126
-        foreach ($values as $key => $value) {
126
+        foreach ($values as $key => $value){
127 127
             $key = $this->resolveKey($key);
128 128
             $dispatcher?->dispatch(new KeyWriting($key, $value));
129 129
             $array[$key] = $value;
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 
149 149
         $array = [];
150 150
         // Resolve keys and dispatch events
151
-        foreach ($keys as $key) {
151
+        foreach ($keys as $key){
152 152
             $key = $this->resolveKey($key);
153 153
             $dispatcher?->dispatch(new KeyDeleting($key));
154 154
             $array[] = $key;
@@ -179,6 +179,6 @@  discard block
 block discarded – undo
179 179
 
180 180
     private function resolveKey(string $key): string
181 181
     {
182
-        return $this->prefix . $key;
182
+        return $this->prefix.$key;
183 183
     }
184 184
 }
Please login to merge, or discard this patch.