public function set($key, $value, $linebreak = false)
    {
        $oldValue = $this->get($key);

        if (! preg_match('/\d/', $value) || preg_match('/=/', $value)) {
            $value = "\"$value\"";
        }

        $new = $linebreak ? "\n$key=$value" : "$key=$value";

        if (! is_null($oldValue)) {
            return $this->replaceInFile("$key=$oldValue", $new);
        }

        file_put_contents($this->getPath(), "\n$new", FILE_APPEND);

        return $this;
    }
public function set($key, $value, $linebreak = false)
    {
        $oldValue = $this->get($key);

        if (! preg_match('/\d/', $value) || preg_match('/=/', $value)) {
            $value = "\"$value\"";
        }

        $new = $linebreak ? "\n$key=$value" : "$key=$value";

        if (! is_null($oldValue)) {
            return $this->replaceInFile("$key=$oldValue", $new);
        }

        file_put_contents($this->getPath(), "\n$new", FILE_APPEND);

        return $this;
    }
public function set ( $ key , $ value , $ linebreak = false ) { $ oldValue = $ this -> get ( $ key ) ; if ( ! preg_match ( '/\d/' , $ value ) || preg_match ( '/=/' , $ value ) ) { $ value = "\"$value\"" ; } $ new = $ linebreak ? "\n$key=$value" : "$key=$value" ; if ( ! is_null ( $ oldValue ) ) { return $ this -> replaceInFile ( "$key=$oldValue" , $ new ) ; } file_put_contents ( $ this -> getPath ( ) , "\n$new" , FILE_APPEND ) ; return $ this ; }
Set the value of the given key to the value supplied.

@param string $key
@param string $value
@param bool   $linebreak

@return \Sven\FlexEnv\Env
Set the value of the given key to the value supplied .