private function validate(array $values) { foreach (LaravelLang::getRequiredColumns() as $key) { if (!array_key_exists($key, $values)) { throw new \RuntimeException("Column {$key} doesn't exist in worksheet"); } } }
public function getOptions() { return [['lang', 'l', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'languages to work with', LaravelLang::getDefaultLangs()]]; }
protected function buildFileKeyMapping(ListFeed $listFeed) { $mapping = []; foreach ($listFeed->getEntries() as $entry) { $values = $entry->getValues(); if (!isset($values['file']) || !isset($values['key'])) { throw new \RuntimeException('each row must have file, key columns'); } $file = $values['file']; $key = $values['key']; if (!isset($mapping[$file])) { $mapping[$file] = []; } if (!isset($mapping[$file][$key])) { $mapping[$file][$key] = []; } foreach ($values as $lang => $message) { if (in_array($lang, LaravelLang::getDefaultLangs())) { $mapping[$file][$key][$lang] = $message; } } } return $mapping; }