@@ -30,7 +30,7 @@ |
||
30 | 30 | $limit = null; |
31 | 31 | } |
32 | 32 | if (empty($limit)) { |
33 | - $result = (!empty($offset)) ? substr($what, $offset) : $what ; |
|
33 | + $result = (!empty($offset)) ? substr($what, $offset) : $what; |
|
34 | 34 | } else { |
35 | 35 | $result = (!empty($offset)) ? substr($what, $offset, $limit) : substr($what, 0, $limit); |
36 | 36 | } |
@@ -135,7 +135,7 @@ |
||
135 | 135 | |
136 | 136 | public function load(string $key) |
137 | 137 | { |
138 | - return $this->exists($key) ? $this->data[$key] : null ; |
|
138 | + return $this->exists($key) ? $this->data[$key] : null; |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | public function save(string $key, $data, ?int $timeout = null): bool |
@@ -17,18 +17,18 @@ |
||
17 | 17 | */ |
18 | 18 | public function testStrings(): void |
19 | 19 | { |
20 | - $this->assertEquals('bcdef', substr('abcdef', 1)); |
|
21 | - $this->assertEquals('bcd', substr('abcdef', 1, 3)); |
|
22 | - $this->assertEquals('abcd', substr('abcdef', 0, 4)); |
|
20 | + $this->assertEquals('bcdef', substr('abcdef', 1)); |
|
21 | + $this->assertEquals('bcd', substr('abcdef', 1, 3)); |
|
22 | + $this->assertEquals('abcd', substr('abcdef', 0, 4)); |
|
23 | 23 | $this->assertEquals('abcdef', substr('abcdef', 0, 8)); |
24 | - $this->assertEquals('f', substr('abcdef', -1, 1)); |
|
24 | + $this->assertEquals('f', substr('abcdef', -1, 1)); |
|
25 | 25 | |
26 | 26 | // now with lib |
27 | - $this->assertEquals('bcdef', Support\Strings::substr('abcdef', 1, null, '')); |
|
28 | - $this->assertEquals('bcd', Support\Strings::substr('abcdef', 1, 3, '')); |
|
29 | - $this->assertEquals('abcd', Support\Strings::substr('abcdef', 0, 4, '')); |
|
27 | + $this->assertEquals('bcdef', Support\Strings::substr('abcdef', 1, null, '')); |
|
28 | + $this->assertEquals('bcd', Support\Strings::substr('abcdef', 1, 3, '')); |
|
29 | + $this->assertEquals('abcd', Support\Strings::substr('abcdef', 0, 4, '')); |
|
30 | 30 | $this->assertEquals('abcdef', Support\Strings::substr('abcdef', 0, 8, '')); |
31 | - $this->assertEquals('f', Support\Strings::substr('abcdef', -1, 1, '')); |
|
31 | + $this->assertEquals('f', Support\Strings::substr('abcdef', -1, 1, '')); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -66,7 +66,7 @@ |
||
66 | 66 | */ |
67 | 67 | public function testRandom(): void |
68 | 68 | { |
69 | - $this->assertEquals('aaaaaaa', Keys\Random::generateRandomText(7, ['a','a','a','a'])); |
|
69 | + $this->assertEquals('aaaaaaa', Keys\Random::generateRandomText(7, ['a', 'a', 'a', 'a'])); |
|
70 | 70 | |
71 | 71 | $lang = new Translations(); |
72 | 72 | $lib = new Keys\Random($lang, new TargetSearch($lang, new Support\InfoRam($lang), new Support\DataRam($lang))); |
@@ -31,7 +31,7 @@ |
||
31 | 31 | $lib = new UploadPerPartes\examples\Uploader(); |
32 | 32 | $this->sendResponse($lib->check( |
33 | 33 | $this->getHttpRequest()->getPost()->__get('sharedKey'), |
34 | - (int)$this->getHttpRequest()->getPost()->__get('segment')) |
|
34 | + (int) $this->getHttpRequest()->getPost()->__get('segment')) |
|
35 | 35 | ); |
36 | 36 | } |
37 | 37 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | protected $keyLength = 64; |
18 | 18 | |
19 | 19 | /** @var string[] */ |
20 | - public static $possibilities = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']; |
|
20 | + public static $possibilities = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']; |
|
21 | 21 | |
22 | 22 | public function fromSharedKey(string $key): string |
23 | 23 | { |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | public function getTemporaryTargetLocation(): string |
124 | 124 | { |
125 | 125 | $this->checkFileBase(); |
126 | - return $this->targetDir . $this->fileBase . $this->addExt(). static::FILE_UPLOAD_SUFF; |
|
126 | + return $this->targetDir . $this->fileBase . $this->addExt() . static::FILE_UPLOAD_SUFF; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | do { |
169 | 169 | $location = $this->fileBase . static::FILE_VER_SEP . $i; |
170 | 170 | $i++; |
171 | - } while ( $this->dataStorage->exists($this->targetDir . $location . $ext) ); |
|
171 | + } while ($this->dataStorage->exists($this->targetDir . $location . $ext)); |
|
172 | 172 | $this->fileBase = $location; |
173 | 173 | } |
174 | 174 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $this->fileBase = mb_substr( |
187 | 187 | $this->fileBase($f), |
188 | 188 | 0, |
189 | - (static::WIN_NAME_LEN_LIMIT - (int)mb_strlen($this->fileExt)) |
|
189 | + (static::WIN_NAME_LEN_LIMIT - (int) mb_strlen($this->fileExt)) |
|
190 | 190 | ); // win limit... cut more due possibility of uploading multiple files with same name |
191 | 191 | } |
192 | 192 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | |
209 | 209 | protected function addExt(): string |
210 | 210 | { |
211 | - return ($this->hasExt() ? static::FILE_EXT_SEP . $this->fileExt : '' ); |
|
211 | + return ($this->hasExt() ? static::FILE_EXT_SEP . $this->fileExt : ''); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | protected function hasExt(): bool |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | public function __construct(int $bytesPerPart = null) |
19 | 19 | { |
20 | - $this->bytesPerPart = empty($bytesPerPart) ? static::DEFAULT_BYTES_PER_PART : $bytesPerPart ; |
|
20 | + $this->bytesPerPart = empty($bytesPerPart) ? static::DEFAULT_BYTES_PER_PART : $bytesPerPart; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | public function getBytesPerPart(): int |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | public function calcParts(int $length): int |
29 | 29 | { |
30 | - $partsCounter = (int)($length / $this->bytesPerPart); |
|
31 | - return (($length % $this->bytesPerPart) == 0) ? (int)$partsCounter : (int)($partsCounter + 1); |
|
30 | + $partsCounter = (int) ($length / $this->bytesPerPart); |
|
31 | + return (($length % $this->bytesPerPart) == 0) ? (int) $partsCounter : (int) ($partsCounter + 1); |
|
32 | 32 | } |
33 | 33 | } |
@@ -41,10 +41,10 @@ |
||
41 | 41 | public function jsonSerialize() |
42 | 42 | { |
43 | 43 | return [ |
44 | - 'sharedKey' => (string)$this->sharedKey, |
|
45 | - 'lastKnownPart' => (int)$this->data->lastKnownPart, |
|
46 | - 'status' => (string)$this->status, |
|
47 | - 'errorMessage' => (string)$this->errorMessage, |
|
44 | + 'sharedKey' => (string) $this->sharedKey, |
|
45 | + 'lastKnownPart' => (int) $this->data->lastKnownPart, |
|
46 | + 'status' => (string) $this->status, |
|
47 | + 'errorMessage' => (string) $this->errorMessage, |
|
48 | 48 | ]; |
49 | 49 | } |
50 | 50 | } |