Gdn_ConfigurationSource::remove PHP Method

remove() public method

Returns false if the key is not found for removal, true otherwise.
public remove ( string $Name ) : boolean
$Name string The name of the configuration setting with dot notation.
return boolean Whether or not the key was found.
    public function remove($Name)
    {
        // Make sure this source' config settings are in the right format
        if (!is_array($this->Settings)) {
            $this->Settings = array();
        }
        $Found = false;
        $Keys = explode('.', $Name);
        // If splitting is off, HANDLE IT
        if (!$this->Splitting) {
            $FirstKey = val(0, $Keys);
            if ($FirstKey == $this->Group) {
                $Keys = array(array_shift($Keys), implode('.', $Keys));
            } else {
                $Keys = array($Name);
            }
        }
        $KeyCount = count($Keys);
        $Settings =& $this->Settings;
        for ($i = 0; $i < $KeyCount; ++$i) {
            $Key = $Keys[$i];
            // Key will always be in here if it is anywhere at all
            if (array_key_exists($Key, $Settings)) {
                if ($i == $KeyCount - 1) {
                    // We are at the setting, so unset it.
                    $Found = true;
                    unset($Settings[$Key]);
                    $this->Dirty = true;
                } else {
                    // Advance the pointer
                    $Settings =& $Settings[$Key];
                }
            } else {
                $Found = false;
                break;
            }
        }
        return $Found;
    }