Completed
Pull Request — master (#147)
by Shuvro
21s
created
tests/Console/Command/IndexDeleteCommandTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 {
16 16
     public function testIndexDeleteMustSucceed(): void
17 17
     {
18
-        $this->mock(Client::class, function (MockInterface $mock) {
18
+        $this->mock(Client::class, function(MockInterface $mock) {
19 19
             $mock->shouldReceive('indices')
20 20
                 ->times(2)
21 21
                 ->andReturn(
22
-                    $this->mock(IndicesNamespace::class, function (MockInterface $mock) {
22
+                    $this->mock(IndicesNamespace::class, function(MockInterface $mock) {
23 23
                         $mock->shouldReceive('exists')
24 24
                             ->andReturn(true);
25 25
 
@@ -38,11 +38,11 @@  discard block
 block discarded – undo
38 38
 
39 39
     public function testIndexDeleteMustFail(): void
40 40
     {
41
-        $this->mock(Client::class, function (MockInterface $mock) {
41
+        $this->mock(Client::class, function(MockInterface $mock) {
42 42
             $mock->shouldReceive('indices')
43 43
                 ->times(2)
44 44
                 ->andReturn(
45
-                    $this->mock(IndicesNamespace::class, function (MockInterface $mock) {
45
+                    $this->mock(IndicesNamespace::class, function(MockInterface $mock) {
46 46
                         $mock->shouldReceive('exists')
47 47
                             ->andReturn(true);
48 48
 
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 
64 64
     public function testIndexDeleteMustFailBecauseIndexDoesntExists(): void
65 65
     {
66
-        $this->mock(Client::class, function (MockInterface $mock) {
66
+        $this->mock(Client::class, function(MockInterface $mock) {
67 67
             $mock->shouldReceive('indices')
68 68
                 ->once()
69 69
                 ->andReturn(
70
-                    $this->mock(IndicesNamespace::class, function (MockInterface $mock) {
70
+                    $this->mock(IndicesNamespace::class, function(MockInterface $mock) {
71 71
                         $mock->shouldReceive('exists')
72 72
                             ->andReturn(false);
73 73
 
Please login to merge, or discard this patch.
tests/Console/Command/IndexCreateCommandTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 {
16 16
     public function testCreateIndexMustSucceed(): void
17 17
     {
18
-        $this->mock(Client::class, function (MockInterface $mock) {
18
+        $this->mock(Client::class, function(MockInterface $mock) {
19 19
             $mock->shouldReceive('indices')
20 20
                 ->times(2)
21 21
                 ->andReturn(
22
-                    $this->mock(IndicesNamespace::class, function (MockInterface $mock) {
22
+                    $this->mock(IndicesNamespace::class, function(MockInterface $mock) {
23 23
                         $mock->shouldReceive('exists')
24 24
                             ->andReturn(false);
25 25
 
@@ -38,11 +38,11 @@  discard block
 block discarded – undo
38 38
 
39 39
     public function testCreateIndexMustFail(): void
40 40
     {
41
-        $this->mock(Client::class, function (MockInterface $mock) {
41
+        $this->mock(Client::class, function(MockInterface $mock) {
42 42
             $mock->shouldReceive('indices')
43 43
                 ->times(2)
44 44
                 ->andReturn(
45
-                    $this->mock(IndicesNamespace::class, function (MockInterface $mock) {
45
+                    $this->mock(IndicesNamespace::class, function(MockInterface $mock) {
46 46
                         $mock->shouldReceive('exists')
47 47
                             ->andReturn(false);
48 48
 
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 
64 64
     public function testCreateIndexMustFailBecauseIndexAlreadyExists(): void
65 65
     {
66
-        $this->mock(Client::class, function (MockInterface $mock) {
66
+        $this->mock(Client::class, function(MockInterface $mock) {
67 67
             $mock->shouldReceive('indices')
68 68
                 ->once()
69 69
                 ->andReturn(
70
-                    $this->mock(IndicesNamespace::class, function (MockInterface $mock) {
70
+                    $this->mock(IndicesNamespace::class, function(MockInterface $mock) {
71 71
                         $mock->shouldReceive('exists')
72 72
                             ->andReturn(true);
73 73
 
Please login to merge, or discard this patch.
tests/Console/Command/IndexCreateOrUpdateMappingCommandTest.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 {
17 17
     public function testCreateOrUpdateMappingMustSucceed(): void
18 18
     {
19
-        $this->mock(Filesystem::class, function (MockInterface $mock) {
19
+        $this->mock(Filesystem::class, function(MockInterface $mock) {
20 20
             $mock->shouldReceive('exists')
21 21
                 ->once()
22 22
                 ->andReturn(true);
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
                 ->andReturn('{}');
27 27
         });
28 28
 
29
-        $this->mock(Client::class, function (MockInterface $mock) {
29
+        $this->mock(Client::class, function(MockInterface $mock) {
30 30
             $mock->shouldReceive('indices')
31 31
                 ->times(2)
32 32
                 ->andReturn(
33
-                    $this->mock(IndicesNamespace::class, function (MockInterface $mock) {
33
+                    $this->mock(IndicesNamespace::class, function(MockInterface $mock) {
34 34
                         $mock->shouldReceive('exists')
35 35
                             ->once()
36 36
                             ->andReturn(true);
@@ -54,13 +54,13 @@  discard block
 block discarded – undo
54 54
 
55 55
     public function testCreateOrUpdateMappingMustFailBecauseMappingFileDoesntExistsOnFilesystem(): void
56 56
     {
57
-        $this->mock(Filesystem::class, function (MockInterface $mock) {
57
+        $this->mock(Filesystem::class, function(MockInterface $mock) {
58 58
             $mock->shouldReceive('exists')
59 59
                 ->once()
60 60
                 ->andReturn(false);
61 61
         });
62 62
 
63
-        $this->mock(Client::class, function (MockInterface $mock) {
63
+        $this->mock(Client::class, function(MockInterface $mock) {
64 64
             $mock->shouldNotReceive('indices');
65 65
         });
66 66
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
     public function testCreateOrUpdateMappingMustCreateNewIndexIfIndexDoesntExists(): void
78 78
     {
79
-        $this->mock(Filesystem::class, function (MockInterface $mock) {
79
+        $this->mock(Filesystem::class, function(MockInterface $mock) {
80 80
             $mock->shouldReceive('exists')
81 81
                 ->once()
82 82
                 ->andReturn(true);
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
                 ->andReturn('{}');
87 87
         });
88 88
 
89
-        $this->mock(Client::class, function (MockInterface $mock) {
89
+        $this->mock(Client::class, function(MockInterface $mock) {
90 90
             $mock->shouldReceive('indices')
91 91
                 ->times(2)
92 92
                 ->andReturn(
93
-                    $this->mock(IndicesNamespace::class, function (MockInterface $mock) {
93
+                    $this->mock(IndicesNamespace::class, function(MockInterface $mock) {
94 94
                         $mock->shouldReceive('exists')
95 95
                             ->once()
96 96
                             ->andReturn(false);
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 
115 115
     public function testCreateOrUpdateMappingMustFail(): void
116 116
     {
117
-        $this->mock(Filesystem::class, function (MockInterface $mock) {
117
+        $this->mock(Filesystem::class, function(MockInterface $mock) {
118 118
             $mock->shouldReceive('exists')
119 119
                 ->once()
120 120
                 ->andReturn(true);
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
                 ->andReturn('{}');
125 125
         });
126 126
 
127
-        $this->mock(Client::class, function (MockInterface $mock) {
127
+        $this->mock(Client::class, function(MockInterface $mock) {
128 128
             $mock->shouldReceive('indices')
129 129
                 ->times(2)
130 130
                 ->andReturn(
131
-                    $this->mock(IndicesNamespace::class, function (MockInterface $mock) {
131
+                    $this->mock(IndicesNamespace::class, function(MockInterface $mock) {
132 132
                         $mock->shouldReceive('exists')
133 133
                             ->once()
134 134
                             ->andReturn(true);
Please login to merge, or discard this patch.
tests/Console/Command/IndexExistsCommandTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
 {
15 15
     public function testIndexExists(): void
16 16
     {
17
-        $this->mock(Client::class, function (MockInterface $mock) {
17
+        $this->mock(Client::class, function(MockInterface $mock) {
18 18
             $mock->shouldReceive('indices')
19 19
                 ->once()
20 20
                 ->andReturn(
21
-                    $this->mock(IndicesNamespace::class, function (MockInterface $mock) {
21
+                    $this->mock(IndicesNamespace::class, function(MockInterface $mock) {
22 22
                         $mock->shouldReceive('exists')
23 23
                             ->once()
24 24
                             ->andReturn(true);
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
 
36 36
     public function testIndexDoesntExists(): void
37 37
     {
38
-        $this->mock(Client::class, function (MockInterface $mock) {
38
+        $this->mock(Client::class, function(MockInterface $mock) {
39 39
             $mock->shouldReceive('indices')
40 40
                 ->once()
41 41
                 ->andReturn(
42
-                    $this->mock(IndicesNamespace::class, function (MockInterface $mock) {
42
+                    $this->mock(IndicesNamespace::class, function(MockInterface $mock) {
43 43
                         $mock->shouldReceive('exists')
44 44
                             ->once()
45 45
                             ->andReturn(false);
Please login to merge, or discard this patch.
tests/Console/Command/AliasCreateCommandTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 {
16 16
     public function testAliasCreateMustSucceed(): void
17 17
     {
18
-        $this->mock(Client::class, function (MockInterface $mock) {
18
+        $this->mock(Client::class, function(MockInterface $mock) {
19 19
             $mock->shouldReceive('indices')
20 20
                 ->times(2)
21 21
                 ->andReturn(
22
-                    $this->mock(IndicesNamespace::class, function (MockInterface $mock) {
22
+                    $this->mock(IndicesNamespace::class, function(MockInterface $mock) {
23 23
                         $mock->shouldReceive('exists')
24 24
                             ->once()
25 25
                             ->andReturn(true);
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
 
44 44
     public function testAliasCreateMustFail(): void
45 45
     {
46
-        $this->mock(Client::class, function (MockInterface $mock) {
46
+        $this->mock(Client::class, function(MockInterface $mock) {
47 47
             $mock->shouldReceive('indices')
48 48
                 ->times(2)
49 49
                 ->andReturn(
50
-                    $this->mock(IndicesNamespace::class, function (MockInterface $mock) {
50
+                    $this->mock(IndicesNamespace::class, function(MockInterface $mock) {
51 51
                         $mock->shouldReceive('exists')
52 52
                             ->once()
53 53
                             ->andReturn(true);
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
 
74 74
     public function testAliasCreateMustFailBecauseIndexDoesntExists(): void
75 75
     {
76
-        $this->mock(Client::class, function (MockInterface $mock) {
76
+        $this->mock(Client::class, function(MockInterface $mock) {
77 77
             $mock->shouldReceive('indices')
78 78
                 ->once()
79 79
                 ->andReturn(
80
-                    $this->mock(IndicesNamespace::class, function (MockInterface $mock) {
80
+                    $this->mock(IndicesNamespace::class, function(MockInterface $mock) {
81 81
                         $mock->shouldReceive('exists')
82 82
                             ->once()
83 83
                             ->andReturn(false);
Please login to merge, or discard this patch.
tests/Console/Command/AliasSwitchIndexCommandTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 {
16 16
     public function testSwitchIndexMustSucceed(): void
17 17
     {
18
-        $this->mock(Client::class, function (MockInterface $mock) {
18
+        $this->mock(Client::class, function(MockInterface $mock) {
19 19
             $mock->shouldReceive('indices')
20 20
                 ->times(3)
21 21
                 ->andReturn(
22
-                    $this->mock(IndicesNamespace::class, function (MockInterface $mock) {
22
+                    $this->mock(IndicesNamespace::class, function(MockInterface $mock) {
23 23
                         $mock->shouldReceive('exists')
24 24
                             ->once()
25 25
                             ->andReturn(true);
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 
51 51
     public function testSwitchIndexMustFailBecauseNewIndexDoesntExists(): void
52 52
     {
53
-        $this->mock(Client::class, function (MockInterface $mock) {
53
+        $this->mock(Client::class, function(MockInterface $mock) {
54 54
             $mock->shouldReceive('indices')
55 55
                 ->once()
56 56
                 ->andReturn(
57
-                    $this->mock(IndicesNamespace::class, function (MockInterface $mock) {
57
+                    $this->mock(IndicesNamespace::class, function(MockInterface $mock) {
58 58
                         $mock->shouldReceive('exists')
59 59
                             ->once()
60 60
                             ->andReturn(false);
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
 
82 82
     public function testSwitchIndexMustFailDueToPutAliasException(): void
83 83
     {
84
-        $this->mock(Client::class, function (MockInterface $mock) {
84
+        $this->mock(Client::class, function(MockInterface $mock) {
85 85
             $mock->shouldReceive('indices')
86 86
                 ->times(2)
87 87
                 ->andReturn(
88
-                    $this->mock(IndicesNamespace::class, function (MockInterface $mock) {
88
+                    $this->mock(IndicesNamespace::class, function(MockInterface $mock) {
89 89
                         $mock->shouldReceive('exists')
90 90
                             ->once()
91 91
                             ->andReturn(true);
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
 
119 119
     public function testSwitchIndexMustFailDueToDeleteAliasException(): void
120 120
     {
121
-        $this->mock(Client::class, function (MockInterface $mock) {
121
+        $this->mock(Client::class, function(MockInterface $mock) {
122 122
             $mock->shouldReceive('indices')
123 123
                 ->times(3)
124 124
                 ->andReturn(
125
-                    $this->mock(IndicesNamespace::class, function (MockInterface $mock) {
125
+                    $this->mock(IndicesNamespace::class, function(MockInterface $mock) {
126 126
                         $mock->shouldReceive('exists')
127 127
                             ->once()
128 128
                             ->andReturn(true);
Please login to merge, or discard this patch.
tests/Console/Command/AliasRemoveIndexCommandTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 {
16 16
     public function testAliasRemoveMustSucceed(): void
17 17
     {
18
-        $this->mock(Client::class, function (MockInterface $mock) {
18
+        $this->mock(Client::class, function(MockInterface $mock) {
19 19
             $mock->shouldReceive('indices')
20 20
                 ->times(2)
21 21
                 ->andReturn(
22
-                    $this->mock(IndicesNamespace::class, function (MockInterface $mock) {
22
+                    $this->mock(IndicesNamespace::class, function(MockInterface $mock) {
23 23
                         $mock->shouldReceive('exists')
24 24
                             ->once()
25 25
                             ->andReturn(true);
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
 
44 44
     public function testAliasRemoveMustFail(): void
45 45
     {
46
-        $this->mock(Client::class, function (MockInterface $mock) {
46
+        $this->mock(Client::class, function(MockInterface $mock) {
47 47
             $mock->shouldReceive('indices')
48 48
                 ->times(2)
49 49
                 ->andReturn(
50
-                    $this->mock(IndicesNamespace::class, function (MockInterface $mock) {
50
+                    $this->mock(IndicesNamespace::class, function(MockInterface $mock) {
51 51
                         $mock->shouldReceive('exists')
52 52
                             ->once()
53 53
                             ->andReturn(true);
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
 
76 76
     public function testAliasRemoveMustFailBecauseIndexDoesntExists(): void
77 77
     {
78
-        $this->mock(Client::class, function (MockInterface $mock) {
78
+        $this->mock(Client::class, function(MockInterface $mock) {
79 79
             $mock->shouldReceive('indices')
80 80
                 ->once()
81 81
                 ->andReturn(
82
-                    $this->mock(IndicesNamespace::class, function (MockInterface $mock) {
82
+                    $this->mock(IndicesNamespace::class, function(MockInterface $mock) {
83 83
                         $mock->shouldReceive('exists')
84 84
                             ->once()
85 85
                             ->andReturn(false);
Please login to merge, or discard this patch.
src/Factory.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         // Configure handlers for any AWS hosts
99 99
         foreach ($config['hosts'] as $host) {
100 100
             if (isset($host['aws']) && $host['aws']) {
101
-                $clientBuilder->setHandler(function (array $request) use ($host) {
101
+                $clientBuilder->setHandler(function(array $request) use ($host) {
102 102
                     $psr7Handler = \Aws\default_http_handler();
103 103
                     $signer = new \Aws\Signature\SignatureV4('es', $host['aws_region']);
104 104
                     $request['headers']['Host'][0] = parse_url($request['headers']['Host'][0])['host'] ?? $request['headers']['Host'][0];
@@ -158,9 +158,9 @@  discard block
 block discarded – undo
158 158
 
159 159
                     // Send the signed request to Amazon ES
160 160
                     $response = $psr7Handler($signedRequest, ['http_stats_receiver' => $http_stats])
161
-                        ->then(function (ResponseInterface $response) {
161
+                        ->then(function(ResponseInterface $response) {
162 162
                             return $response;
163
-                        }, function ($error) {
163
+                        }, function($error) {
164 164
                             return $error['response'];
165 165
                         })
166 166
                         ->wait();
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -182,9 +182,9 @@
 block discarded – undo
182 182
 
183 183
         // Build and return the client
184 184
         if (
185
-             !empty($host['api_id']) && $host['api_id'] !== null &&
185
+                !empty($host['api_id']) && $host['api_id'] !== null &&
186 186
              !empty($host['api_key']) && $host['api_key'] !== null
187
-         ) {
187
+            ) {
188 188
             $clientBuilder->setApiKey($host['api_id'], $host['api_key']);
189 189
         }
190 190
 
Please login to merge, or discard this patch.