public function at(int $idx, $expectedTag = null): UnspecifiedType
    {
        if (!isset($this->_elements[$idx])) {
            throw new \OutOfBoundsException(
                "Structure doesn't have an element at index $idx.");
        }
        $element = $this->_elements[$idx];
        if (isset($expectedTag)) {
            $element->expectType($expectedTag);
        }
        return new UnspecifiedType($element);
    }
public function at(int $idx, $expectedTag = null): UnspecifiedType
    {
        if (!isset($this->_elements[$idx])) {
            throw new \OutOfBoundsException(
                "Structure doesn't have an element at index $idx.");
        }
        $element = $this->_elements[$idx];
        if (isset($expectedTag)) {
            $element->expectType($expectedTag);
        }
        return new UnspecifiedType($element);
    }
public function at ( int $ idx , $ expectedTag = null ) : UnspecifiedType { if ( ! isset ( $ this -> _elements [ $ idx ] ) ) { throw new \ OutOfBoundsException ( "Structure doesn't have an element at index $idx." ) ; } $ element = $ this -> _elements [ $ idx ] ; if ( isset ( $ expectedTag ) ) { $ element -> expectType ( $ expectedTag ) ; } return new UnspecifiedType ( $ element ) ; }
Get the element at the given index, optionally checking that the element
has a given tag.

<strong>NOTE!</strong> Expectation checking is deprecated and should be
done with <code>UnspecifiedType</code>.

@param int $idx Index 0..n
@param int|null $expectedTag Optional type tag expectation
@throws \OutOfBoundsException If element doesn't exists
@throws \UnexpectedValueException If expectation fails
@return UnspecifiedType
Get the element at the given index optionally checking that the element has a given tag .