GraphQL\Utils\MixedStore::offsetGet PHP Method

offsetGet() public method

Offset to retrieve
public offsetGet ( mixed $offset ) : mixed
$offset mixed

The offset to retrieve.

return mixed Can return all value types.
    public function offsetGet($offset)
    {
        if (is_scalar($offset)) {
            return $this->scalarStore[$offset];
        }
        if (is_object($offset)) {
            return $this->objectStore->offsetGet($offset);
        }
        if (is_array($offset)) {
            // offsetGet is often called directly after offsetExists, so optimize to avoid second loop:
            if ($this->lastArrayKey === $offset) {
                return $this->lastArrayValue;
            }
            foreach ($this->arrayKeys as $index => $entry) {
                if ($entry === $offset) {
                    return $this->arrayValues[$index];
                }
            }
        }
        return null;
    }