Code Duplication    Length = 12-14 lines in 2 locations

lib/Elastica/Index.php 1 location

@@ 93-106 (lines=14) @@
90
     *
91
     * @return array
92
     */
93
    public function getMapping()
94
    {
95
        $response = $this->requestEndpoint(new Get());
96
        $data = $response->getData();
97
98
        // Get first entry as if index is an Alias, the name of the mapping is the real name and not alias name
99
        $mapping = array_shift($data);
100
101
        if (isset($mapping['mappings'])) {
102
            return $mapping['mappings'];
103
        }
104
105
        return [];
106
    }
107
108
    /**
109
     * Returns the index settings object.

lib/Elastica/Type.php 1 location

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