@@ -37,7 +37,8 @@ |
||
37 | 37 | $mail->setBCC('[email protected]'); |
38 | 38 | |
39 | 39 | $queue->expects('push')->withArgs( |
40 | - function ($job, $data, Options $options) use ($mail) { |
|
40 | + function ($job, $data, Options $options) use ($mail) |
|
41 | + { |
|
41 | 42 | $this->assertSame(MailQueue::JOB_NAME, $job); |
42 | 43 | $this->assertSame($data, MessageSerializer::pack($mail)); |
43 | 44 | $this->assertSame('mailer', $options->getPipeline()); |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function getDefaultStorage(): string |
33 | 33 | { |
34 | - if (!isset($this->config['default']) || empty($this->config['default'])) { |
|
34 | + if (!isset($this->config['default']) || empty($this->config['default'])){ |
|
35 | 35 | throw new InvalidArgumentException('Default cache storage is not defined.'); |
36 | 36 | } |
37 | 37 | |
38 | - if (!\is_string($this->config['default'])) { |
|
38 | + if (!\is_string($this->config['default'])){ |
|
39 | 39 | throw new InvalidArgumentException('Default cache storage config value must be a string'); |
40 | 40 | } |
41 | 41 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | public function getStorageConfig(string $name): array |
46 | 46 | { |
47 | - if (!isset($this->config['storages'][$name])) { |
|
47 | + if (!isset($this->config['storages'][$name])){ |
|
48 | 48 | throw new InvalidArgumentException( |
49 | 49 | sprintf('Config for storage `%s` is not defined.', $name) |
50 | 50 | ); |
@@ -52,19 +52,19 @@ discard block |
||
52 | 52 | |
53 | 53 | $config = $this->config['storages'][$name]; |
54 | 54 | |
55 | - if (!isset($config['type'])) { |
|
55 | + if (!isset($config['type'])){ |
|
56 | 56 | throw new InvalidArgumentException( |
57 | 57 | sprintf('Storage type for `%s` is not defined.', $name) |
58 | 58 | ); |
59 | 59 | } |
60 | 60 | |
61 | - if (!\is_string($config['type'])) { |
|
61 | + if (!\is_string($config['type'])){ |
|
62 | 62 | throw new InvalidArgumentException( |
63 | 63 | \sprintf('Storage type value for `%s` must be a string', $name) |
64 | 64 | ); |
65 | 65 | } |
66 | 66 | |
67 | - if (isset($this->config['typeAliases'][$config['type']])) { |
|
67 | + if (isset($this->config['typeAliases'][$config['type']])){ |
|
68 | 68 | $config['type'] = $this->config['typeAliases'][$config['type']]; |
69 | 69 | } |
70 | 70 |
@@ -31,11 +31,13 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function getDefaultStorage(): string |
33 | 33 | { |
34 | - if (!isset($this->config['default']) || empty($this->config['default'])) { |
|
34 | + if (!isset($this->config['default']) || empty($this->config['default'])) |
|
35 | + { |
|
35 | 36 | throw new InvalidArgumentException('Default cache storage is not defined.'); |
36 | 37 | } |
37 | 38 | |
38 | - if (!\is_string($this->config['default'])) { |
|
39 | + if (!\is_string($this->config['default'])) |
|
40 | + { |
|
39 | 41 | throw new InvalidArgumentException('Default cache storage config value must be a string'); |
40 | 42 | } |
41 | 43 | |
@@ -44,7 +46,8 @@ discard block |
||
44 | 46 | |
45 | 47 | public function getStorageConfig(string $name): array |
46 | 48 | { |
47 | - if (!isset($this->config['storages'][$name])) { |
|
49 | + if (!isset($this->config['storages'][$name])) |
|
50 | + { |
|
48 | 51 | throw new InvalidArgumentException( |
49 | 52 | sprintf('Config for storage `%s` is not defined.', $name) |
50 | 53 | ); |
@@ -52,19 +55,22 @@ discard block |
||
52 | 55 | |
53 | 56 | $config = $this->config['storages'][$name]; |
54 | 57 | |
55 | - if (!isset($config['type'])) { |
|
58 | + if (!isset($config['type'])) |
|
59 | + { |
|
56 | 60 | throw new InvalidArgumentException( |
57 | 61 | sprintf('Storage type for `%s` is not defined.', $name) |
58 | 62 | ); |
59 | 63 | } |
60 | 64 | |
61 | - if (!\is_string($config['type'])) { |
|
65 | + if (!\is_string($config['type'])) |
|
66 | + { |
|
62 | 67 | throw new InvalidArgumentException( |
63 | 68 | \sprintf('Storage type value for `%s` must be a string', $name) |
64 | 69 | ); |
65 | 70 | } |
66 | 71 | |
67 | - if (isset($this->config['typeAliases'][$config['type']])) { |
|
72 | + if (isset($this->config['typeAliases'][$config['type']])) |
|
73 | + { |
|
68 | 74 | $config['type'] = $this->config['typeAliases'][$config['type']]; |
69 | 75 | } |
70 | 76 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | public function get($key, $default = null) |
29 | 29 | { |
30 | - if (!isset($this->storage[$key])) { |
|
30 | + if (!isset($this->storage[$key])){ |
|
31 | 31 | return $default; |
32 | 32 | } |
33 | 33 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | $expiresAt = $item['timestamp'] ?? 0; |
37 | 37 | |
38 | - if ($expiresAt !== 0 && time() >= $expiresAt) { |
|
38 | + if ($expiresAt !== 0 && time() >= $expiresAt){ |
|
39 | 39 | $this->delete($key); |
40 | 40 | |
41 | 41 | return $default; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | public function delete($key): bool |
58 | 58 | { |
59 | - if ($this->has($key)) { |
|
59 | + if ($this->has($key)){ |
|
60 | 60 | unset($this->storage[$key]); |
61 | 61 | |
62 | 62 | return true; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | { |
77 | 77 | $return = []; |
78 | 78 | |
79 | - foreach ($keys as $key) { |
|
79 | + foreach ($keys as $key){ |
|
80 | 80 | $return[$key] = $this->get($key, $default); |
81 | 81 | } |
82 | 82 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | public function setMultiple($values, $ttl = null): bool |
87 | 87 | { |
88 | - foreach ($values as $key => $value) { |
|
88 | + foreach ($values as $key => $value){ |
|
89 | 89 | $this->set($key, $value, $ttl); |
90 | 90 | } |
91 | 91 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | { |
97 | 97 | $state = null; |
98 | 98 | |
99 | - foreach ($keys as $key) { |
|
99 | + foreach ($keys as $key){ |
|
100 | 100 | $result = $this->delete($key); |
101 | 101 | |
102 | 102 | $state = is_null($state) ? $result : $result && $state; |
@@ -27,7 +27,8 @@ discard block |
||
27 | 27 | |
28 | 28 | public function get($key, $default = null) |
29 | 29 | { |
30 | - if (!isset($this->storage[$key])) { |
|
30 | + if (!isset($this->storage[$key])) |
|
31 | + { |
|
31 | 32 | return $default; |
32 | 33 | } |
33 | 34 | |
@@ -35,7 +36,8 @@ discard block |
||
35 | 36 | |
36 | 37 | $expiresAt = $item['timestamp'] ?? 0; |
37 | 38 | |
38 | - if ($expiresAt !== 0 && time() >= $expiresAt) { |
|
39 | + if ($expiresAt !== 0 && time() >= $expiresAt) |
|
40 | + { |
|
39 | 41 | $this->delete($key); |
40 | 42 | |
41 | 43 | return $default; |
@@ -56,7 +58,8 @@ discard block |
||
56 | 58 | |
57 | 59 | public function delete($key): bool |
58 | 60 | { |
59 | - if ($this->has($key)) { |
|
61 | + if ($this->has($key)) |
|
62 | + { |
|
60 | 63 | unset($this->storage[$key]); |
61 | 64 | |
62 | 65 | return true; |
@@ -76,7 +79,8 @@ discard block |
||
76 | 79 | { |
77 | 80 | $return = []; |
78 | 81 | |
79 | - foreach ($keys as $key) { |
|
82 | + foreach ($keys as $key) |
|
83 | + { |
|
80 | 84 | $return[$key] = $this->get($key, $default); |
81 | 85 | } |
82 | 86 | |
@@ -85,7 +89,8 @@ discard block |
||
85 | 89 | |
86 | 90 | public function setMultiple($values, $ttl = null): bool |
87 | 91 | { |
88 | - foreach ($values as $key => $value) { |
|
92 | + foreach ($values as $key => $value) |
|
93 | + { |
|
89 | 94 | $this->set($key, $value, $ttl); |
90 | 95 | } |
91 | 96 | |
@@ -96,7 +101,8 @@ discard block |
||
96 | 101 | { |
97 | 102 | $state = null; |
98 | 103 | |
99 | - foreach ($keys as $key) { |
|
104 | + foreach ($keys as $key) |
|
105 | + { |
|
100 | 106 | $result = $this->delete($key); |
101 | 107 | |
102 | 108 | $state = is_null($state) ? $result : $result && $state; |
@@ -14,21 +14,21 @@ |
||
14 | 14 | */ |
15 | 15 | private function ttlToTimestamp($ttl): int |
16 | 16 | { |
17 | - if ($ttl === null) { |
|
17 | + if ($ttl === null){ |
|
18 | 18 | return $this->ttl + time(); |
19 | 19 | } |
20 | 20 | |
21 | - if ($ttl instanceof \DateInterval) { |
|
21 | + if ($ttl instanceof \DateInterval){ |
|
22 | 22 | return $this->now() |
23 | 23 | ->add($ttl) |
24 | 24 | ->getTimestamp(); |
25 | 25 | } |
26 | 26 | |
27 | - if ($ttl instanceof \DateTimeInterface) { |
|
27 | + if ($ttl instanceof \DateTimeInterface){ |
|
28 | 28 | return $ttl->getTimestamp(); |
29 | 29 | } |
30 | 30 | |
31 | - if (\is_int($ttl)) { |
|
31 | + if (\is_int($ttl)){ |
|
32 | 32 | $now = $this->now(); |
33 | 33 | |
34 | 34 | return $now->getTimestamp() + $ttl; |
@@ -14,21 +14,25 @@ |
||
14 | 14 | */ |
15 | 15 | private function ttlToTimestamp($ttl): int |
16 | 16 | { |
17 | - if ($ttl === null) { |
|
17 | + if ($ttl === null) |
|
18 | + { |
|
18 | 19 | return $this->ttl + time(); |
19 | 20 | } |
20 | 21 | |
21 | - if ($ttl instanceof \DateInterval) { |
|
22 | + if ($ttl instanceof \DateInterval) |
|
23 | + { |
|
22 | 24 | return $this->now() |
23 | 25 | ->add($ttl) |
24 | 26 | ->getTimestamp(); |
25 | 27 | } |
26 | 28 | |
27 | - if ($ttl instanceof \DateTimeInterface) { |
|
29 | + if ($ttl instanceof \DateTimeInterface) |
|
30 | + { |
|
28 | 31 | return $ttl->getTimestamp(); |
29 | 32 | } |
30 | 33 | |
31 | - if (\is_int($ttl)) { |
|
34 | + if (\is_int($ttl)) |
|
35 | + { |
|
32 | 36 | $now = $this->now(); |
33 | 37 | |
34 | 38 | return $now->getTimestamp() + $ttl; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | { |
38 | 38 | return $this->files->write( |
39 | 39 | $this->makePath($key), |
40 | - $this->ttlToTimestamp($ttl) . serialize($value), |
|
40 | + $this->ttlToTimestamp($ttl).serialize($value), |
|
41 | 41 | null, |
42 | 42 | true |
43 | 43 | ); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | public function delete($key): bool |
47 | 47 | { |
48 | - if ($this->has($key)) { |
|
48 | + if ($this->has($key)){ |
|
49 | 49 | return $this->files->delete($this->makePath($key)); |
50 | 50 | } |
51 | 51 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | public function clear(): bool |
56 | 56 | { |
57 | - if (!$this->files->isDirectory($this->path)) { |
|
57 | + if (!$this->files->isDirectory($this->path)){ |
|
58 | 58 | return false; |
59 | 59 | } |
60 | 60 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | { |
68 | 68 | $result = []; |
69 | 69 | |
70 | - foreach ($keys as $key) { |
|
70 | + foreach ($keys as $key){ |
|
71 | 71 | $result[$key] = $this->get($key, $default); |
72 | 72 | } |
73 | 73 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | { |
79 | 79 | $state = null; |
80 | 80 | |
81 | - foreach ($values as $key => $value) { |
|
81 | + foreach ($values as $key => $value){ |
|
82 | 82 | $result = $this->set($key, $value, $ttl); |
83 | 83 | $state = is_null($state) ? $result : $result && $state; |
84 | 84 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | public function deleteMultiple($keys) |
90 | 90 | { |
91 | 91 | $state = null; |
92 | - foreach ($keys as $key) { |
|
92 | + foreach ($keys as $key){ |
|
93 | 93 | $result = $this->delete($key); |
94 | 94 | $state = is_null($state) ? $result : $result && $state; |
95 | 95 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | { |
110 | 110 | $parts = array_slice(str_split($hash = sha1($key), 2), 0, 2); |
111 | 111 | |
112 | - return $this->path . '/' . implode('/', $parts) . '/' . $hash; |
|
112 | + return $this->path.'/'.implode('/', $parts).'/'.$hash; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -119,25 +119,25 @@ discard block |
||
119 | 119 | { |
120 | 120 | $path = $this->makePath($key); |
121 | 121 | |
122 | - try { |
|
123 | - $expire = (int) substr( |
|
122 | + try{ |
|
123 | + $expire = (int)substr( |
|
124 | 124 | $contents = $this->files->read($path), |
125 | 125 | 0, |
126 | 126 | 10 |
127 | 127 | ); |
128 | - } catch (FileNotFoundException $e) { |
|
128 | + }catch (FileNotFoundException $e){ |
|
129 | 129 | return $this->makeEmptyPayload(); |
130 | 130 | } |
131 | 131 | |
132 | - if (time() >= $expire) { |
|
132 | + if (time() >= $expire){ |
|
133 | 133 | $this->delete($key); |
134 | 134 | |
135 | 135 | return $this->makeEmptyPayload(); |
136 | 136 | } |
137 | 137 | |
138 | - try { |
|
138 | + try{ |
|
139 | 139 | $data = unserialize(substr($contents, 10)); |
140 | - } catch (\Exception $e) { |
|
140 | + }catch (\Exception $e){ |
|
141 | 141 | $this->delete($key); |
142 | 142 | |
143 | 143 | return $this->makeEmptyPayload(); |
@@ -45,7 +45,8 @@ discard block |
||
45 | 45 | |
46 | 46 | public function delete($key): bool |
47 | 47 | { |
48 | - if ($this->has($key)) { |
|
48 | + if ($this->has($key)) |
|
49 | + { |
|
49 | 50 | return $this->files->delete($this->makePath($key)); |
50 | 51 | } |
51 | 52 | |
@@ -54,7 +55,8 @@ discard block |
||
54 | 55 | |
55 | 56 | public function clear(): bool |
56 | 57 | { |
57 | - if (!$this->files->isDirectory($this->path)) { |
|
58 | + if (!$this->files->isDirectory($this->path)) |
|
59 | + { |
|
58 | 60 | return false; |
59 | 61 | } |
60 | 62 | |
@@ -67,7 +69,8 @@ discard block |
||
67 | 69 | { |
68 | 70 | $result = []; |
69 | 71 | |
70 | - foreach ($keys as $key) { |
|
72 | + foreach ($keys as $key) |
|
73 | + { |
|
71 | 74 | $result[$key] = $this->get($key, $default); |
72 | 75 | } |
73 | 76 | |
@@ -78,7 +81,8 @@ discard block |
||
78 | 81 | { |
79 | 82 | $state = null; |
80 | 83 | |
81 | - foreach ($values as $key => $value) { |
|
84 | + foreach ($values as $key => $value) |
|
85 | + { |
|
82 | 86 | $result = $this->set($key, $value, $ttl); |
83 | 87 | $state = is_null($state) ? $result : $result && $state; |
84 | 88 | } |
@@ -89,7 +93,8 @@ discard block |
||
89 | 93 | public function deleteMultiple($keys) |
90 | 94 | { |
91 | 95 | $state = null; |
92 | - foreach ($keys as $key) { |
|
96 | + foreach ($keys as $key) |
|
97 | + { |
|
93 | 98 | $result = $this->delete($key); |
94 | 99 | $state = is_null($state) ? $result : $result && $state; |
95 | 100 | } |
@@ -119,25 +124,32 @@ discard block |
||
119 | 124 | { |
120 | 125 | $path = $this->makePath($key); |
121 | 126 | |
122 | - try { |
|
127 | + try |
|
128 | + { |
|
123 | 129 | $expire = (int) substr( |
124 | 130 | $contents = $this->files->read($path), |
125 | 131 | 0, |
126 | 132 | 10 |
127 | 133 | ); |
128 | - } catch (FileNotFoundException $e) { |
|
134 | + } |
|
135 | + catch (FileNotFoundException $e) |
|
136 | + { |
|
129 | 137 | return $this->makeEmptyPayload(); |
130 | 138 | } |
131 | 139 | |
132 | - if (time() >= $expire) { |
|
140 | + if (time() >= $expire) |
|
141 | + { |
|
133 | 142 | $this->delete($key); |
134 | 143 | |
135 | 144 | return $this->makeEmptyPayload(); |
136 | 145 | } |
137 | 146 | |
138 | - try { |
|
147 | + try |
|
148 | + { |
|
139 | 149 | $data = unserialize(substr($contents, 10)); |
140 | - } catch (\Exception $e) { |
|
150 | + } |
|
151 | + catch (\Exception $e) |
|
152 | + { |
|
141 | 153 | $this->delete($key); |
142 | 154 | |
143 | 155 | return $this->makeEmptyPayload(); |
@@ -33,7 +33,7 @@ |
||
33 | 33 | // Replaces alias with real storage name |
34 | 34 | $name = $this->config->getAliases()[$name] ?? $name; |
35 | 35 | |
36 | - if (isset($this->storages[$name])) { |
|
36 | + if (isset($this->storages[$name])){ |
|
37 | 37 | return $this->storages[$name]; |
38 | 38 | } |
39 | 39 |
@@ -33,7 +33,8 @@ |
||
33 | 33 | // Replaces alias with real storage name |
34 | 34 | $name = $this->config->getAliases()[$name] ?? $name; |
35 | 35 | |
36 | - if (isset($this->storages[$name])) { |
|
36 | + if (isset($this->storages[$name])) |
|
37 | + { |
|
37 | 38 | return $this->storages[$name]; |
38 | 39 | } |
39 | 40 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | public function testGetsWithExistsValueAndCacheFile(): void |
39 | 39 | { |
40 | 40 | $ttl = time() + self::DEFAULT_TTL; |
41 | - $value = $ttl . 's:3:"bar";'; |
|
41 | + $value = $ttl.'s:3:"bar";'; |
|
42 | 42 | $path = self::DEFAULT_PATH; |
43 | 43 | |
44 | 44 | $this->files->shouldReceive('read')->with($path)->andReturn($value); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | { |
62 | 62 | $path = self::DEFAULT_PATH; |
63 | 63 | |
64 | - $this->files->shouldReceive('read')->with($path)->andReturn(time() . 's:3:"bar";'); |
|
64 | + $this->files->shouldReceive('read')->with($path)->andReturn(time().'s:3:"bar";'); |
|
65 | 65 | $this->files->shouldReceive('exists')->with($path)->andReturn(true); |
66 | 66 | $this->files->shouldReceive('delete')->with($path)->andReturnTrue(); |
67 | 67 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | public function testGetsWithExistsValueWithDeadValue(): void |
72 | 72 | { |
73 | 73 | $ttl = time() + self::DEFAULT_TTL; |
74 | - $value = $ttl . 's:3:"barbar";'; |
|
74 | + $value = $ttl.'s:3:"barbar";'; |
|
75 | 75 | $path = self::DEFAULT_PATH; |
76 | 76 | |
77 | 77 | $this->files->shouldReceive('read')->with($path)->andReturn($value); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | public function testSetsWithDefaultTTL(): void |
85 | 85 | { |
86 | 86 | $ttl = time() + self::DEFAULT_TTL; |
87 | - $value = $ttl . 's:3:"bar";'; |
|
87 | + $value = $ttl.'s:3:"bar";'; |
|
88 | 88 | |
89 | 89 | $this->files->shouldReceive('write')->with(self::DEFAULT_PATH, $value, null, true)->andReturnTrue(); |
90 | 90 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | public function testSetsWithTTLInSeconds(): void |
95 | 95 | { |
96 | 96 | $ttl = time() + 30; |
97 | - $value = $ttl . 's:3:"bar";'; |
|
97 | + $value = $ttl.'s:3:"bar";'; |
|
98 | 98 | |
99 | 99 | $this->files->shouldReceive('write')->with(self::DEFAULT_PATH, $value, null, true)->andReturnTrue(); |
100 | 100 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | public function testSetsWithTTLInDateInterval(): void |
105 | 105 | { |
106 | 106 | $ttl = time() + 30; |
107 | - $value = $ttl . 's:3:"bar";'; |
|
107 | + $value = $ttl.'s:3:"bar";'; |
|
108 | 108 | |
109 | 109 | $this->files->shouldReceive('write')->with(self::DEFAULT_PATH, $value, null, true)->andReturnTrue(); |
110 | 110 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | public function testSetsWithTTLInDateTime(): void |
115 | 115 | { |
116 | 116 | $ttl = time() + 30; |
117 | - $value = $ttl . 's:3:"bar";'; |
|
117 | + $value = $ttl.'s:3:"bar";'; |
|
118 | 118 | |
119 | 119 | $this->files->shouldReceive('write')->with(self::DEFAULT_PATH, $value, null, true)->andReturnTrue(); |
120 | 120 | |
@@ -161,15 +161,15 @@ discard block |
||
161 | 161 | { |
162 | 162 | $this->files->shouldReceive('read')->with( |
163 | 163 | 'path/to/cache/0b/ee/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33' |
164 | - )->andReturn((time() + self::DEFAULT_TTL) . 's:3:"abc";'); |
|
164 | + )->andReturn((time() + self::DEFAULT_TTL).'s:3:"abc";'); |
|
165 | 165 | |
166 | 166 | $this->files->shouldReceive('read')->with( |
167 | 167 | 'path/to/cache/62/cd/62cdb7020ff920e5aa642c3d4066950dd1f01f4d' |
168 | - )->andReturn((time() + self::DEFAULT_TTL) . 's:3:"cde";'); |
|
168 | + )->andReturn((time() + self::DEFAULT_TTL).'s:3:"cde";'); |
|
169 | 169 | |
170 | 170 | $this->files->shouldReceive('read')->with( |
171 | 171 | 'path/to/cache/bb/e9/bbe960a25ea311d21d40669e93df2003ba9b90a2' |
172 | - )->andReturn((time() + -1) . 's:3:"efg";'); |
|
172 | + )->andReturn((time() + -1).'s:3:"efg";'); |
|
173 | 173 | $this->files->shouldReceive('exists')->with( |
174 | 174 | 'path/to/cache/bb/e9/bbe960a25ea311d21d40669e93df2003ba9b90a2' |
175 | 175 | )->andReturnFalse(); |
@@ -186,15 +186,15 @@ discard block |
||
186 | 186 | $ttl = time() + self::DEFAULT_TTL; |
187 | 187 | |
188 | 188 | $this->files->shouldReceive('write') |
189 | - ->with('path/to/cache/0b/ee/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33', $ttl . 's:3:"baz";', null, true) |
|
189 | + ->with('path/to/cache/0b/ee/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33', $ttl.'s:3:"baz";', null, true) |
|
190 | 190 | ->andReturnTrue(); |
191 | 191 | |
192 | 192 | $this->files->shouldReceive('write') |
193 | - ->with('path/to/cache/62/cd/62cdb7020ff920e5aa642c3d4066950dd1f01f4d', $ttl . 's:3:"foo";', null, true) |
|
193 | + ->with('path/to/cache/62/cd/62cdb7020ff920e5aa642c3d4066950dd1f01f4d', $ttl.'s:3:"foo";', null, true) |
|
194 | 194 | ->andReturnTrue(); |
195 | 195 | |
196 | 196 | $this->files->shouldReceive('write') |
197 | - ->with('path/to/cache/bb/e9/bbe960a25ea311d21d40669e93df2003ba9b90a2', $ttl . 's:3:"bar";', null, true) |
|
197 | + ->with('path/to/cache/bb/e9/bbe960a25ea311d21d40669e93df2003ba9b90a2', $ttl.'s:3:"bar";', null, true) |
|
198 | 198 | ->andReturnTrue(); |
199 | 199 | |
200 | 200 | $this->assertTrue( |
@@ -211,15 +211,15 @@ discard block |
||
211 | 211 | $ttl = time() + 30; |
212 | 212 | |
213 | 213 | $this->files->shouldReceive('write') |
214 | - ->with('path/to/cache/0b/ee/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33', $ttl . 's:3:"baz";', null, true) |
|
214 | + ->with('path/to/cache/0b/ee/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33', $ttl.'s:3:"baz";', null, true) |
|
215 | 215 | ->andReturnTrue(); |
216 | 216 | |
217 | 217 | $this->files->shouldReceive('write') |
218 | - ->with('path/to/cache/62/cd/62cdb7020ff920e5aa642c3d4066950dd1f01f4d', $ttl . 's:3:"foo";', null, true) |
|
218 | + ->with('path/to/cache/62/cd/62cdb7020ff920e5aa642c3d4066950dd1f01f4d', $ttl.'s:3:"foo";', null, true) |
|
219 | 219 | ->andReturnTrue(); |
220 | 220 | |
221 | 221 | $this->files->shouldReceive('write') |
222 | - ->with('path/to/cache/bb/e9/bbe960a25ea311d21d40669e93df2003ba9b90a2', $ttl . 's:3:"bar";', null, true) |
|
222 | + ->with('path/to/cache/bb/e9/bbe960a25ea311d21d40669e93df2003ba9b90a2', $ttl.'s:3:"bar";', null, true) |
|
223 | 223 | ->andReturnTrue(); |
224 | 224 | |
225 | 225 | $this->assertTrue( |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | { |
46 | 46 | $entities = []; |
47 | 47 | $attributes = ['role', 'mapper', 'repository', 'table', 'database']; |
48 | - foreach ($attributes as $attribute) { |
|
49 | - if (!empty($this->$attribute)) { |
|
48 | + foreach ($attributes as $attribute){ |
|
49 | + if (!empty($this->$attribute)){ |
|
50 | 50 | $entities[] = "$attribute=\"{$this->$attribute}\""; |
51 | 51 | } |
52 | 52 | } |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | private function makeFieldComment(string $name, string $type): string |
69 | 69 | { |
70 | 70 | $columns = []; |
71 | - if ($this->isNullableType($type)) { |
|
71 | + if ($this->isNullableType($type)){ |
|
72 | 72 | $columns = ['nullable = true']; |
73 | 73 | } |
74 | 74 | $columns[] = "type = \"{$this->annotatedType($type)}\""; |
75 | 75 | |
76 | - if (!empty($this->inflection)) { |
|
76 | + if (!empty($this->inflection)){ |
|
77 | 77 | $columns = $this->addInflectedName($this->inflection, $name, $columns); |
78 | 78 | } |
79 | 79 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | private function addInflectedName(string $inflection, string $name, array $columns): array |
91 | 91 | { |
92 | 92 | $inflected = $this->inflect($inflection, $name); |
93 | - if ($inflected !== null && $inflected !== $name) { |
|
93 | + if ($inflected !== null && $inflected !== $name){ |
|
94 | 94 | $columns[] = "name = \"$inflected\""; |
95 | 95 | } |
96 | 96 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | private function inflect(string $inflection, string $value): ?string |
101 | 101 | { |
102 | - switch ($inflection) { |
|
102 | + switch ($inflection){ |
|
103 | 103 | case 'tableize': |
104 | 104 | case 't': |
105 | 105 | return $this->tableize($value); |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | |
116 | 116 | private function tableize(string $name): string |
117 | 117 | { |
118 | - return ( new InflectorFactory() ) |
|
118 | + return (new InflectorFactory()) |
|
119 | 119 | ->build() |
120 | 120 | ->tableize($name); |
121 | 121 | } |
122 | 122 | |
123 | 123 | private function camelize(string $name): string |
124 | 124 | { |
125 | - return ( new InflectorFactory() ) |
|
125 | + return (new InflectorFactory()) |
|
126 | 126 | ->build() |
127 | 127 | ->camelize($name); |
128 | 128 | } |
@@ -45,8 +45,10 @@ discard block |
||
45 | 45 | { |
46 | 46 | $entities = []; |
47 | 47 | $attributes = ['role', 'mapper', 'repository', 'table', 'database']; |
48 | - foreach ($attributes as $attribute) { |
|
49 | - if (!empty($this->$attribute)) { |
|
48 | + foreach ($attributes as $attribute) |
|
49 | + { |
|
50 | + if (!empty($this->$attribute)) |
|
51 | + { |
|
50 | 52 | $entities[] = "$attribute=\"{$this->$attribute}\""; |
51 | 53 | } |
52 | 54 | } |
@@ -68,12 +70,14 @@ discard block |
||
68 | 70 | private function makeFieldComment(string $name, string $type): string |
69 | 71 | { |
70 | 72 | $columns = []; |
71 | - if ($this->isNullableType($type)) { |
|
73 | + if ($this->isNullableType($type)) |
|
74 | + { |
|
72 | 75 | $columns = ['nullable = true']; |
73 | 76 | } |
74 | 77 | $columns[] = "type = \"{$this->annotatedType($type)}\""; |
75 | 78 | |
76 | - if (!empty($this->inflection)) { |
|
79 | + if (!empty($this->inflection)) |
|
80 | + { |
|
77 | 81 | $columns = $this->addInflectedName($this->inflection, $name, $columns); |
78 | 82 | } |
79 | 83 | |
@@ -90,7 +94,8 @@ discard block |
||
90 | 94 | private function addInflectedName(string $inflection, string $name, array $columns): array |
91 | 95 | { |
92 | 96 | $inflected = $this->inflect($inflection, $name); |
93 | - if ($inflected !== null && $inflected !== $name) { |
|
97 | + if ($inflected !== null && $inflected !== $name) |
|
98 | + { |
|
94 | 99 | $columns[] = "name = \"$inflected\""; |
95 | 100 | } |
96 | 101 | |
@@ -99,7 +104,8 @@ discard block |
||
99 | 104 | |
100 | 105 | private function inflect(string $inflection, string $value): ?string |
101 | 106 | { |
102 | - switch ($inflection) { |
|
107 | + switch ($inflection) |
|
108 | + { |
|
103 | 109 | case 'tableize': |
104 | 110 | case 't': |
105 | 111 | return $this->tableize($value); |
@@ -25,7 +25,7 @@ |
||
25 | 25 | |
26 | 26 | public function patch(array $config): array |
27 | 27 | { |
28 | - foreach ($this->patches as $patch) { |
|
28 | + foreach ($this->patches as $patch){ |
|
29 | 29 | $config = $patch->patch($config); |
30 | 30 | } |
31 | 31 |
@@ -25,7 +25,8 @@ |
||
25 | 25 | |
26 | 26 | public function patch(array $config): array |
27 | 27 | { |
28 | - foreach ($this->patches as $patch) { |
|
28 | + foreach ($this->patches as $patch) |
|
29 | + { |
|
29 | 30 | $config = $patch->patch($config); |
30 | 31 | } |
31 | 32 |