@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require __DIR__.'/../vendor/autoload.php'; |
|
3 | +require __DIR__ . '/../vendor/autoload.php'; |
|
4 | 4 | |
5 | 5 | use Matecat\SimpleS3\Components\Cache\RedisCache; |
6 | 6 | |
7 | -$config = parse_ini_file(__DIR__.'/../config/credentials.ini'); |
|
7 | +$config = parse_ini_file(__DIR__ . '/../config/credentials.ini'); |
|
8 | 8 | $s3Client = new Matecat\SimpleS3\Client( |
9 | 9 | [ |
10 | 10 | 'version' => $config['VERSION'], |
@@ -30,24 +30,24 @@ discard block |
||
30 | 30 | echo 'ELAPSED TIME:' . (microtime(true) - $x) . PHP_EOL . PHP_EOL; |
31 | 31 | |
32 | 32 | $x = microtime(true); |
33 | -echo 'UPLOAD '. $n . ' ITEMS IN THE BUCKET' . PHP_EOL; |
|
33 | +echo 'UPLOAD ' . $n . ' ITEMS IN THE BUCKET' . PHP_EOL; |
|
34 | 34 | echo '----------------------------------------' . PHP_EOL; |
35 | 35 | |
36 | -for ($i=0;$i<$n;$i++) { |
|
36 | +for ($i = 0; $i < $n; $i++) { |
|
37 | 37 | $rand = rand(11111111, 99999999); |
38 | 38 | $body = 'lorem ipsum'; |
39 | 39 | |
40 | 40 | $s3Client->uploadItemFromBody([ |
41 | 41 | 'bucket' => 'mauretto78-benchmark-test-bucket', |
42 | - 'key' => 'folder/'.$rand . '.txt', |
|
42 | + 'key' => 'folder/' . $rand . '.txt', |
|
43 | 43 | 'body' => $body |
44 | 44 | ]); |
45 | 45 | } |
46 | 46 | |
47 | -echo 'ELAPSED TIME:' . (microtime(true) - $x) . PHP_EOL. PHP_EOL; |
|
47 | +echo 'ELAPSED TIME:' . (microtime(true) - $x) . PHP_EOL . PHP_EOL; |
|
48 | 48 | |
49 | 49 | $x = microtime(true); |
50 | -echo 'GET '. $n . ' ITEMS IN THE BUCKET' . PHP_EOL; |
|
50 | +echo 'GET ' . $n . ' ITEMS IN THE BUCKET' . PHP_EOL; |
|
51 | 51 | echo '----------------------------------------' . PHP_EOL; |
52 | 52 | |
53 | 53 | $s3Client->getItemsInABucket([ |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | 'prefix' => 'folder/', |
56 | 56 | ]); |
57 | 57 | |
58 | -echo 'ELAPSED TIME:' . (microtime(true) - $x) . PHP_EOL. PHP_EOL; |
|
58 | +echo 'ELAPSED TIME:' . (microtime(true) - $x) . PHP_EOL . PHP_EOL; |
|
59 | 59 | |
60 | 60 | $x = microtime(true); |
61 | 61 | echo 'DELETE FOLDER IN THE BUCKET' . PHP_EOL; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | 'prefix' => 'folder/', |
67 | 67 | ]); |
68 | 68 | |
69 | -echo 'ELAPSED TIME:' . (microtime(true) - $x) . PHP_EOL. PHP_EOL; |
|
69 | +echo 'ELAPSED TIME:' . (microtime(true) - $x) . PHP_EOL . PHP_EOL; |
|
70 | 70 | |
71 | 71 | $x = microtime(true); |
72 | 72 | echo 'DELETE BUCKET' . PHP_EOL; |
@@ -76,4 +76,4 @@ discard block |
||
76 | 76 | 'bucket' => 'mauretto78-benchmark-test-bucket', |
77 | 77 | ]); |
78 | 78 | |
79 | -echo 'ELAPSED TIME:' . (microtime(true) - $x) . PHP_EOL. PHP_EOL; |
|
79 | +echo 'ELAPSED TIME:' . (microtime(true) - $x) . PHP_EOL . PHP_EOL; |
@@ -231,10 +231,10 @@ |
||
231 | 231 | public static function open($filename, $sslVerify = true) |
232 | 232 | { |
233 | 233 | $context = stream_context_create([ |
234 | - 'ssl' => [ |
|
234 | + 'ssl' => [ |
|
235 | 235 | 'verify_peer' => (($sslVerify)) ? $sslVerify : true, |
236 | 236 | 'verify_peer_name' => (($sslVerify)) ? $sslVerify : true, |
237 | - ] |
|
237 | + ] |
|
238 | 238 | ]); |
239 | 239 | |
240 | 240 | return fopen($filename, 'r', false, $context); |
@@ -124,7 +124,7 @@ |
||
124 | 124 | { |
125 | 125 | $params = isset($args[0]) ? $args[0] : []; |
126 | 126 | |
127 | - $commandHandler = 'Matecat\\SimpleS3\\Commands\\Handlers\\'.ucfirst($name); |
|
127 | + $commandHandler = 'Matecat\\SimpleS3\\Commands\\Handlers\\' . ucfirst($name); |
|
128 | 128 | |
129 | 129 | if (false === class_exists($commandHandler)) { |
130 | 130 | throw new \InvalidArgumentException($commandHandler . ' is not a valid command name. Please refer to README to get the complete command list.'); |
@@ -54,7 +54,7 @@ |
||
54 | 54 | 'key' => $key, |
55 | 55 | 'save_as' => $saveAs |
56 | 56 | ])) { |
57 | - $io->success('The item was successfully downloaded into ['.$saveAs.']'); |
|
57 | + $io->success('The item was successfully downloaded into [' . $saveAs . ']'); |
|
58 | 58 | } else { |
59 | 59 | $io->error('There was an error in the download of the item'); |
60 | 60 | } |
@@ -60,8 +60,8 @@ |
||
60 | 60 | |
61 | 61 | try { |
62 | 62 | $manager = new Transfer($this->s3Client->getConn(), $src, $dest, [ |
63 | - 'before' => function (CommandInterface $command) use ($output, $from, $to) { |
|
64 | - $output->writeln('Transferring <fg=green>['.$command['Key'].']</> from '. $from .' to ' . $to); |
|
63 | + 'before' => function(CommandInterface $command) use ($output, $from, $to) { |
|
64 | + $output->writeln('Transferring <fg=green>[' . $command['Key'] . ']</> from ' . $from . ' to ' . $to); |
|
65 | 65 | } |
66 | 66 | ]); |
67 | 67 | $manager->transfer(); |
@@ -70,7 +70,7 @@ |
||
70 | 70 | |
71 | 71 | $files = []; |
72 | 72 | foreach ($inCache as $item) { |
73 | - $files[$item] = $this->s3Client->getConn()->doesObjectExist($bucket, $item); |
|
73 | + $files[$item] = $this->s3Client->getConn()->doesObjectExist($bucket, $item); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | $tableFeed[$index] = [ |
@@ -41,7 +41,7 @@ |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | // check for string length |
44 | - if(strlen(urlencode($string)) > 221){ |
|
44 | + if (strlen(urlencode($string)) > 221) { |
|
45 | 45 | $errors[] = 'The string is too long (max length of urlencoded string is 221 bytes)'; |
46 | 46 | } |
47 | 47 |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public function get($bucket, $keyname, $version = null) |
52 | 52 | { |
53 | 53 | if (null != $version) { |
54 | - $keyname .= '<VERSION_ID:'.$version.'>'; |
|
54 | + $keyname .= '<VERSION_ID:' . $version . '>'; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | return unserialize($this->redisClient->hget($this->getHashPrefix($bucket, $keyname), $keyname)); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | public function has($bucket, $keyname, $version = null) |
68 | 68 | { |
69 | 69 | if (null != $version) { |
70 | - $keyname .= '<VERSION_ID:'.$version.'>'; |
|
70 | + $keyname .= '<VERSION_ID:' . $version . '>'; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | return (1 === $this->redisClient->hexists($this->getHashPrefix($bucket, $keyname), $keyname)) ? true : false; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | public function remove($bucket, $keyname, $version = null) |
82 | 82 | { |
83 | 83 | if (null != $version) { |
84 | - $keyname .= '<VERSION_ID:'.$version.'>'; |
|
84 | + $keyname .= '<VERSION_ID:' . $version . '>'; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | $this->redisClient->hdel($this->getHashPrefix($bucket, $keyname), [$keyname]); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | public function set($bucket, $keyname, $content, $version = null, $ttl = null) |
109 | 109 | { |
110 | 110 | if (null != $version) { |
111 | - $keyname .= '<VERSION_ID:'.$version.'>'; |
|
111 | + $keyname .= '<VERSION_ID:' . $version . '>'; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | $this->redisClient->hset($this->getHashPrefix($bucket, $keyname), $keyname, serialize($content)); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | public function ttl($bucket, $keyname, $version = null) |
137 | 137 | { |
138 | 138 | if (null != $version) { |
139 | - $keyname .= '<VERSION_ID:'.$version.'>'; |
|
139 | + $keyname .= '<VERSION_ID:' . $version . '>'; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | return $this->redisClient->ttl($this->getHashPrefix($bucket, $keyname)); |
@@ -38,7 +38,7 @@ |
||
38 | 38 | */ |
39 | 39 | public function log(CommandHandler $commandHandler, $message, $level = 'info') |
40 | 40 | { |
41 | - $msg = '['.get_class($commandHandler).'] ' . $message; |
|
41 | + $msg = '[' . get_class($commandHandler) . '] ' . $message; |
|
42 | 42 | $this->logger->{$level}($msg); |
43 | 43 | } |
44 | 44 |