Code Duplication    Length = 12-14 lines in 2 locations

lib/Elastica/Index.php 1 location

@@ 107-120 (lines=14) @@
104
     *
105
     * @return array
106
     */
107
    public function getMapping()
108
    {
109
        $response = $this->requestEndpoint(new Get());
110
        $data = $response->getData();
111
112
        // Get first entry as if index is an Alias, the name of the mapping is the real name and not alias name
113
        $mapping = array_shift($data);
114
115
        if (isset($mapping['mappings'])) {
116
            return $mapping['mappings'];
117
        }
118
119
        return [];
120
    }
121
122
    /**
123
     * Returns the index settings object.

lib/Elastica/Type.php 1 location

@@ 317-328 (lines=12) @@
314
     *
315
     * @return array Current mapping
316
     */
317
    public function getMapping()
318
    {
319
        $response = $this->requestEndpoint(new Get());
320
        $data = $response->getData();
321
322
        $mapping = array_shift($data);
323
        if (isset($mapping['mappings'])) {
324
            return $mapping['mappings'];
325
        }
326
327
        return [];
328
    }
329
330
    /**
331
     * Create search object.