Code Duplication    Length = 13-17 lines in 2 locations

src/Index/AliasProcessor.php 2 locations

@@ 151-163 (lines=13) @@
148
     * @param Client $client
149
     * @param string $indexName Index name to delete
150
     */
151
    private function deleteIndex(Client $client, $indexName)
152
    {
153
        try {
154
            $path = sprintf('%s', $indexName);
155
            $client->request($path, Request::DELETE);
156
        } catch (ExceptionInterface $deleteOldIndexException) {
157
            throw new \RuntimeException(sprintf(
158
                'Failed to delete index %s with message: %s',
159
                $indexName,
160
                $deleteOldIndexException->getMessage()
161
            ), 0, $deleteOldIndexException);
162
        }
163
    }
164
165
    /**
166
     * Close an index.
@@ 171-187 (lines=17) @@
168
     * @param Client $client
169
     * @param string $indexName
170
     */
171
    private function closeIndex(Client $client, $indexName)
172
    {
173
        try {
174
            $path = sprintf('%s/_close', $indexName);
175
            $client->request($path, Request::POST);
176
        } catch (ExceptionInterface $e) {
177
            throw new \RuntimeException(
178
                sprintf(
179
                    'Failed to close index %s with message: %s',
180
                    $indexName,
181
                    $e->getMessage()
182
                ),
183
                0,
184
                $e
185
            );
186
        }
187
    }
188
189
    /**
190
     * Returns the name of a single index that an alias points to or throws