removeKey() public method

Remove a key from all language files.
public removeKey ( string $fileName, string $key ) : void
$fileName string
$key string
return void
 /**
  * Rename the given oldKey to the newKey.
  *
  * @return void
  */
 private function renameKey()
 {
     try {
         list($file, $key) = explode('.', $this->argument('oldKey'), 2);
     } catch (\ErrorException $e) {
         $this->error('Could not recognize the key you want to rename.');
         return;
     }
     if (Str::contains($this->argument('newKey'), '.')) {
         $this->error('Please provide the new key must not contain a dot.');
         return;
     }
     $newKey = preg_replace('/(\\w+)$/i', $this->argument('newKey'), $key);
     $files = $this->manager->files()[$file];
     $currentValues = [];
     foreach ($files as $languageKey => $filePath) {
         $content = Arr::dot($this->manager->getFileContent($filePath));
         $currentValues[$languageKey] = isset($content[$key]) ? $content[$key] : '';
     }
     $this->manager->removeKey($file, $key);
     $this->manager->fillKeys($file, [$newKey => $currentValues]);
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     try {
         list($file, $key) = explode('.', $this->argument('key'), 2);
     } catch (\ErrorException $e) {
         $this->error('Could not recognize the key you want to remove.');
         return;
     }
     if ($this->confirm("Are you sure you want to remove \"{$file}.{$key}\"?")) {
         if (Str::contains($file, '::')) {
             try {
                 $parts = explode('::', $file);
                 $this->manager->setPathToVendorPackage($parts[0]);
                 $file = $parts[1];
             } catch (\ErrorException $e) {
                 $this->error('Could not recognize the package.');
                 return;
             }
         }
         $this->manager->removeKey($file, $key);
         $this->info("{$file}.{$key} was removed successfully.");
     }
 }