public function getIndex($name = null)
    {
        if (null === $name) {
            return $this->defaultIndex;
        }

        if (!isset($this->indexes[$name])) {
            throw new \InvalidArgumentException(sprintf('The index "%s" does not exist', $name));
        }

        return $this->indexes[$name];
    }
public function getIndex($name = null)
    {
        if (null === $name) {
            return $this->defaultIndex;
        }

        if (!isset($this->indexes[$name])) {
            throw new \InvalidArgumentException(sprintf('The index "%s" does not exist', $name));
        }

        return $this->indexes[$name];
    }
public function getIndex ( $ name = null ) { if ( null === $ name ) { return $ this -> defaultIndex ; } if ( ! isset ( $ this -> indexes [ $ name ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The index "%s" does not exist' , $ name ) ) ; } return $ this -> indexes [ $ name ] ; }
Gets an index by its name.

@param string $name Index to return, or the default index if null

@return Index

@throws \InvalidArgumentException if no index exists for the given name
Gets an index by its name .