/**
  * Execute the command.
  *
  * @return void
  */
 public function handle()
 {
     // get paths of registered namespace hints
     // e.g user in @lang('user::myview') resolving to app/Modules/User/Resources
     $resDirs = Config::get('langcheck.usehints') ? Lang::getHints() : array();
     $resDirs[base_path() . '/resources/lang'] = 'app';
     // check each resource directory
     foreach ($resDirs as $path => $hint) {
         // skip vendor directories
         if (Config::get('langcheck.skipvendor') && strpos($path, "vendor/") !== false) {
             continue;
         }
         // generate path relative to project root
         $shortPath = substr($path, strlen(base_path() . '/'));
         $this->info("Checking '{$shortPath}'...");
         // load translation files into arrays
         $langDirs = File::directories($path);
         $languageData = array();
         foreach ($langDirs as $langDir) {
             $langCode = basename($langDir);
             $arrays = File::files($langDir);
             foreach ($arrays as $file) {
                 $fileName = basename($file);
                 $languageData[$langCode][$fileName] = File::getRequire($file);
             }
         }
         // compare language arrays with each other and find missing entries
         foreach ($languageData as $langCodeA => $langArraysA) {
             foreach ($langArraysA as $fileNameA => $langArrayA) {
                 foreach ($languageData as $langCodeB => $langArraysB) {
                     if ($langCodeA == $langCodeB) {
                         continue;
                     }
                     if (array_key_exists($fileNameA, $langArraysB)) {
                         $result = $this->array_diff_key_recursive($langArrayA, $langArraysB[$fileNameA]);
                         if (!empty($result)) {
                             $keys = implode($this->arrayKeysRecursive($result), ', ');
                             $this->error(" * File '{$fileNameA}':");
                             $this->error("   - Locale '{$langCodeB}' missing [{$keys}] existing in locale '{$langCodeA}'");
                         }
                     } else {
                         $this->error(" * File '{$fileNameA}' existing in locale '{$langCodeA}' is missing for locale '{$langCodeB}'");
                     }
                 }
             }
         }
         $this->info('');
     }
 }