public function getByIndex($index)
    {
        if (! is_numeric($index)) {
            throw new RuntimeException('Index needs to be a numeric value.');
        }

        $index = (int)$index;

        if ($index < 0) {
            $index += count($this->chain);
        }

        return isset($this->chain[$index])
            ? $this->chain[$index]
            : false;
    }
public function getByIndex($index)
    {
        if (! is_numeric($index)) {
            throw new RuntimeException('Index needs to be a numeric value.');
        }

        $index = (int)$index;

        if ($index < 0) {
            $index += count($this->chain);
        }

        return isset($this->chain[$index])
            ? $this->chain[$index]
            : false;
    }
public function getByIndex ( $ index ) { if ( ! is_numeric ( $ index ) ) { throw new RuntimeException ( 'Index needs to be a numeric value.' ) ; } $ index = ( int ) $ index ; if ( $ index < 0 ) { $ index += count ( $ this -> chain ) ; } return isset ( $ this -> chain [ $ index ] ) ? $ this -> chain [ $ index ] : false ; }
Get the instantiation at a specific index.

The first (root) instantiation is 0, with each subsequent level adding 1
more to the index.

Provide a negative index to step back from the end of the chain.
Example: `getByIndex( -2 )` will return the second-to-last element.

@since 0.3.0

@param int $index Element index to retrieve. Negative value to fetch from the end of the chain.

@return string|false Class name of the element at the specified index. False if index not found.
@throws RuntimeException If the index is not a numeric value.
Get the instantiation at a specific index .