/** * {@inheritdoc} * @see ArrayAccess::offsetSet() * * @param string $offset The part of the path * @param Item $value The routing table item */ public function offsetSet($offset, $value) { if ($value === null) { if ($this->offsetExists($offset)) { $this->offsetUnset($offset); } } elseif (!$value instanceof \Scalr\Api\Rest\Routing\Item) { throw new \InvalidArgumentException("Object of the Scalr\\Api\\Rest\\Routing\\Item class is expected for the value."); } else { if (!$value->getPathPart()->isString()) { $this->hasRegexp++; } $this->array[$offset] = $value; } }