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