private function checkIfNameIsProtected($name)
{
$length = strlen($name);
foreach ($this->protectedNames as $protectedName) {
$len = strlen($protectedName);
if ($name === $protectedName) {
throw new \RuntimeException("The parameter `{$name}` cannot be set, because it's protected.");
} elseif ($len < $length && '.' === $name[$len] && 0 === strpos($name, $protectedName)) {
throw new \RuntimeException("The parameter `{$name}` cannot be set, because `{$protectedName}` is protected.");
} elseif ($len > $length && '.' === $protectedName[$length] && 0 === strpos($protectedName, $name)) {
throw new \RuntimeException("The parameter `{$name}` could not be set, because a protected parameter named `{$protectedName}` already exists.");
}
}
}