public function setName(string $name)
    {
        $this->name = $name;
        while (preg_match('/^(.*)\[([^\]]*)\]$/', $name, $matches) === 1)
        {
            if (empty($matches[2]))
            {
                if ($this->name_depth > 1)
                    throw new \InvalidArgumentException("Invalid name: {$this->name}");
                $this->is_array = true;
            } 
            else
                array_unshift($this->name_parts, $matches[2]);

            $name = $matches[1];
            ++$this->name_depth;
        }
        array_unshift($this->name_parts, $name);

        return $this;
    }