Code Duplication    Length = 13-17 lines in 2 locations

Index/AliasProcessor.php 2 locations

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