Metabor\KeyValue\Composite::offsetGet PHP Method

offsetGet() public method

See also: ArrayAccess::offsetGet()
public offsetGet ( $offset )
    public function offsetGet($offset)
    {
        $values = array();
        /* @var $keyValue \ArrayAccess */
        foreach ($this->container as $keyValue) {
            $values[] = $keyValue->offsetGet($offset);
        }
        $values = array_unique($values, SORT_REGULAR);
        switch (count($values)) {
            case 0:
                return;
            case 1:
                return reset($values);
            default:
                throw new \RuntimeException('Offset "' . $offset . '" is not unique!');
        }
    }