protected function checkLockAndValidateName($name)
    {
        if ($this->locked) {
            throw new Exception\LockedContainerException();
        }

        if (!is_string($name) || trim($name) === '') {
            throw new Exception\InvalidNameException($name);
        }
    }