Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/translation/Loader/CsvFileLoader.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 1fec387a4317 |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
27 /** | 27 /** |
28 * {@inheritdoc} | 28 * {@inheritdoc} |
29 */ | 29 */ |
30 protected function loadResource($resource) | 30 protected function loadResource($resource) |
31 { | 31 { |
32 $messages = array(); | 32 $messages = []; |
33 | 33 |
34 try { | 34 try { |
35 $file = new \SplFileObject($resource, 'rb'); | 35 $file = new \SplFileObject($resource, 'rb'); |
36 } catch (\RuntimeException $e) { | 36 } catch (\RuntimeException $e) { |
37 throw new NotFoundResourceException(sprintf('Error opening file "%s".', $resource), 0, $e); | 37 throw new NotFoundResourceException(sprintf('Error opening file "%s".', $resource), 0, $e); |
39 | 39 |
40 $file->setFlags(\SplFileObject::READ_CSV | \SplFileObject::SKIP_EMPTY); | 40 $file->setFlags(\SplFileObject::READ_CSV | \SplFileObject::SKIP_EMPTY); |
41 $file->setCsvControl($this->delimiter, $this->enclosure, $this->escape); | 41 $file->setCsvControl($this->delimiter, $this->enclosure, $this->escape); |
42 | 42 |
43 foreach ($file as $data) { | 43 foreach ($file as $data) { |
44 if ('#' !== substr($data[0], 0, 1) && isset($data[1]) && 2 === count($data)) { | 44 if ('#' !== substr($data[0], 0, 1) && isset($data[1]) && 2 === \count($data)) { |
45 $messages[$data[0]] = $data[1]; | 45 $messages[$data[0]] = $data[1]; |
46 } | 46 } |
47 } | 47 } |
48 | 48 |
49 return $messages; | 49 return $messages; |