/** * Check if all the language files are there * * @param \Closure|null $errorCallback */ public function findMissingFiles(\Closure $errorCallback) { $this->namespaces->each(function ($namespace) use($errorCallback) { $this->languages->each(function ($language) use($namespace, $errorCallback) { $filename = Utils::getLanguageFilename($language, $namespace); if (!file_exists($filename)) { $error = new MissingFileError(); $error->language = $language; $error->namespace = $namespace; $errorCallback($error); $this->skipFile($language, $namespace); } }); }); }
public function findNamespaces(Languages $languages) { $languages->each(function ($lang) { $dir = Utils::getLangDirectory($lang); if (!file_exists($dir)) { throw new \Exception('Cannot read directory for language ' . $lang); } foreach (new \DirectoryIterator($dir) as $file) { if ($file->isFile()) { $basename = $file->getBasename('.php'); if (!$this->contains($basename)) { $this->push($basename); } } } }); return $this; }