original_string: protected function writeEnv($key, $value)
      {
          $dir = app()->environmentPath();
          $file = app()->environmentFile();
          $path = "{$dir}/{$file}";
  
          try {
              (new Dotenv($dir, $file))->load();
  
              $envKey = strtoupper($key);
              $envValue = env($envKey) ?: 'null';
  
              file_put_contents($path, str_replace(
                  "{$envKey}={$envValue}",
                  "{$envKey}={$value}",
                  file_get_contents($path)
              ));
          } catch (InvalidPathException $e) {
              throw $e;
          }
      }
code: protected function writeEnv($key, $value)
      {
          $dir = app()->environmentPath();
          $file = app()->environmentFile();
          $path = "{$dir}/{$file}";
  
          try {
              (new Dotenv($dir, $file))->load();
  
              $envKey = strtoupper($key);
              $envValue = env($envKey) ?: 'null';
  
              file_put_contents($path, str_replace(
                  "{$envKey}={$envValue}",
                  "{$envKey}={$value}",
                  file_get_contents($path)
              ));
          } catch (InvalidPathException $e) {
              throw $e;
          }
      }
code_tokens: protected function writeEnv ( $ key , $ value ) { $ dir = app ( ) -> environmentPath ( ) ; $ file = app ( ) -> environmentFile ( ) ; $ path = "{$dir}/{$file}" ; try { ( new Dotenv ( $ dir , $ file ) ) -> load ( ) ; $ envKey = strtoupper ( $ key ) ; $ envValue = env ( $ envKey ) ? : 'null' ; file_put_contents ( $ path , str_replace ( "{$envKey}={$envValue}" , "{$envKey}={$value}" , file_get_contents ( $ path ) ) ) ; } catch ( InvalidPathException $ e ) { throw $ e ; } }
docstring: Writes to the .env file with given parameters.
  
  @param string $key
  @param mixed  $value
  
  @return void
docstring_tokens: Writes to the . env file with given parameters .