public function setEnd($type, array $end)
    {
        if (!in_array($type, array_keys($this->definition))) {
            throw new \InvalidArgumentException(sprintf(
                'Invalid KeyRange type. Allowed values are %s',
                implode(', ', array_keys($this->definition))
            ));
        }

        $rangeKey = $this->fromDefinition($type, 'end');

        $this->endType = $rangeKey;
        $this->end = $end;
    }