Exemplo n.º 1
0
 private static function removeLineBrakeOnEnd($file)
 {
     $file = explode(");", $file)[0];
     if (ErrorFixer::hasLineBreakAtTheEnd($file)) {
         return rtrim(rtrim($file, "\n"), "\r");
     }
     return $file;
 }
Exemplo n.º 2
0
 private function validateKeys(&$errors, $file)
 {
     foreach (Config::$additional_languages as $lang) {
         $foreignArray = $this->getForeignFileAsArray($file, $lang);
         if ($foreignArray) {
             $misses = new MissingKeyEntity($this->getForeignFileWithPath($file, $lang));
             foreach ($this->sourceArray as $key => $value) {
                 if (!array_key_exists($key, $foreignArray)) {
                     $misses->add($key, $value);
                     array_push($errors, new Error(ErrorCodes::$key_not_exist, $lang, $file->getFilename(), "key generated: [" . $key . "]"));
                 }
             }
             if (Config::$auto_fix && !$misses->isEmpty()) {
                 ErrorFixer::writeMissingKeys($misses);
             }
         }
     }
 }