protected function parseNames($elementIdx = 0)
    {
        if (false === array_key_exists($elementIdx, $this->names)) {
            if (false === array_key_exists($elementIdx, $this->response['elements'])) {
                throw new \Exception('Oups...');
            }

            $this->names[$elementIdx] = [];

            foreach ($this->response['elements'][$elementIdx]['tags'] as $tag => $value) {
                if ('name:' === substr($tag, 0, 5)) {
                    $lang = substr($tag, 5);
                    $this->names[$elementIdx][$lang] = $value;

                    // Ok... let's free a little bit of memory
                    unset($this->response['elements'][$elementIdx]['tags'][$tag]);
                } else if ('name' === $tag) {
                    $this->officialName[$elementIdx] = $value;

                    // Ok... let's free a little bit of memory
                    unset($this->response['elements'][$elementIdx]['tags'][$tag]);
                }
            }
        }
    }
protected function parseNames($elementIdx = 0)
    {
        if (false === array_key_exists($elementIdx, $this->names)) {
            if (false === array_key_exists($elementIdx, $this->response['elements'])) {
                throw new \Exception('Oups...');
            }

            $this->names[$elementIdx] = [];

            foreach ($this->response['elements'][$elementIdx]['tags'] as $tag => $value) {
                if ('name:' === substr($tag, 0, 5)) {
                    $lang = substr($tag, 5);
                    $this->names[$elementIdx][$lang] = $value;

                    // Ok... let's free a little bit of memory
                    unset($this->response['elements'][$elementIdx]['tags'][$tag]);
                } else if ('name' === $tag) {
                    $this->officialName[$elementIdx] = $value;

                    // Ok... let's free a little bit of memory
                    unset($this->response['elements'][$elementIdx]['tags'][$tag]);
                }
            }
        }
    }
protected function parseNames ( $ elementIdx = 0 ) { if ( false === array_key_exists ( $ elementIdx , $ this -> names ) ) { if ( false === array_key_exists ( $ elementIdx , $ this -> response [ 'elements' ] ) ) { throw new \ Exception ( 'Oups...' ) ; } $ this -> names [ $ elementIdx ] = [ ] ; foreach ( $ this -> response [ 'elements' ] [ $ elementIdx ] [ 'tags' ] as $ tag => $ value ) { if ( 'name:' === substr ( $ tag , 0 , 5 ) ) { $ lang = substr ( $ tag , 5 ) ; $ this -> names [ $ elementIdx ] [ $ lang ] = $ value ; // Ok... let's free a little bit of memory unset ( $ this -> response [ 'elements' ] [ $ elementIdx ] [ 'tags' ] [ $ tag ] ) ; } else if ( 'name' === $ tag ) { $ this -> officialName [ $ elementIdx ] = $ value ; // Ok... let's free a little bit of memory unset ( $ this -> response [ 'elements' ] [ $ elementIdx ] [ 'tags' ] [ $ tag ] ) ; } } } }
Parse an element in the response so as to retrieve "alternative" names

@param integer $elementIdx Index of the element in the response

@return void
Parse an element in the response so as to retrieve alternative names