Code Duplication    Length = 14-16 lines in 2 locations

lib/Elastica/Type.php 1 location

@@ 306-319 (lines=14) @@
303
     *
304
     * @return array Current mapping
305
     */
306
    public function getMapping()
307
    {
308
        $path = '_mapping';
309
310
        $response = $this->request($path, Request::GET);
311
        $data = $response->getData();
312
313
        $mapping = array_shift($data);
314
        if (isset($mapping['mappings'])) {
315
            return $mapping['mappings'];
316
        }
317
318
        return [];
319
    }
320
321
    /**
322
     * Create search object.

lib/Elastica/Index.php 1 location

@@ 78-93 (lines=16) @@
75
     *
76
     * @return array
77
     */
78
    public function getMapping()
79
    {
80
        $path = '_mapping';
81
82
        $response = $this->request($path, Request::GET);
83
        $data = $response->getData();
84
85
        // Get first entry as if index is an Alias, the name of the mapping is the real name and not alias name
86
        $mapping = array_shift($data);
87
88
        if (isset($mapping['mappings'])) {
89
            return $mapping['mappings'];
90
        }
91
92
        return [];
93
    }
94
95
    /**
96
     * Returns the index settings object.