Text.php
public function modifyTextContainer($oldName, $newName, $content, $language)
    {
        foreach ($this->languages as $lang) {
            $modified = false;
            $allTexts = $this->getPageTexts($lang);
            if (!isset($allTexts[$oldName])) {
                throw new \Exception("Text container unknown.");
            }
            if ($oldName !== $newName) {
                if (isset($allTexts[$newName])) {
                    throw new \Exception("Text container already exists");
                }
                $this->contents[$lang][$newName] = $this->contents[$lang][$oldName];
                $this->contents[$lang][$newName]['id'] = $newName;
                $this->contents[$lang][$newName]['name'] = $newName;
                unset($this->contents[$lang][$oldName]);
                $modified = true;
            }
            if ($language === $lang) {
                $this->contents[$lang][$newName]['content'] = $content;
                $this->contents[$lang][$newName]['outdated'] = false;
                $modified = true;
            } elseif ($language === $this->baseLang) {
                $this->contents[$lang][$newName]['outdated'] = true;
                $modified = true;
            }
            if ($modified) {
                $this->writeTextsToFile($lang);
            }
        }
        return $this->contents[$language][$newName];
    }
public function modifyTextContainer($oldName, $newName, $content, $language)
    {
        foreach ($this->languages as $lang) {
            $modified = false;
            $allTexts = $this->getPageTexts($lang);
            if (!isset($allTexts[$oldName])) {
                throw new \Exception("Text container unknown.");
            }
            if ($oldName !== $newName) {
                if (isset($allTexts[$newName])) {
                    throw new \Exception("Text container already exists");
                }
                $this->contents[$lang][$newName] = $this->contents[$lang][$oldName];
                $this->contents[$lang][$newName]['id'] = $newName;
                $this->contents[$lang][$newName]['name'] = $newName;
                unset($this->contents[$lang][$oldName]);
                $modified = true;
            }
            if ($language === $lang) {
                $this->contents[$lang][$newName]['content'] = $content;
                $this->contents[$lang][$newName]['outdated'] = false;
                $modified = true;
            } elseif ($language === $this->baseLang) {
                $this->contents[$lang][$newName]['outdated'] = true;
                $modified = true;
            }
            if ($modified) {
                $this->writeTextsToFile($lang);
            }
        }
        return $this->contents[$language][$newName];
    }
Modifies the content and optionally the name of a text container.
If the base language text is changed, the corresponding texts of other languages are invalidated.

@param string $oldName
@param string $newName
@param string $content
@param string $language
@return array
@throws \Exception