/** * {@inheritdoc} */ public function getConfigurations() { try { return array_map([$this->loader, 'load'], $this->fileLocator->locateFilesNamed($this->configurationFilename)); } catch (\InvalidArgumentException $exception) { return []; } }
/** * @param callable $callback * * @return array */ private function processFileResources(callable $callback) { try { $configurationFiles = $this->fileLocator->locateFilesNamed($this->configurationFilename); return array_map($callback, $configurationFiles); } catch (\InvalidArgumentException $exception) { return []; } }
/** * {@inheritdoc} */ public function getConfigurations() { // Handle there being no theme.json file try { $configs = array_map([$this->loader, 'load'], $this->fileLocator->locateFilesNamed($this->configurationFilename)); return array_map([$this->themeHelper, 'process'], $configs); } catch (\InvalidArgumentException $e) { return []; } }
function it_provides_an_empty_list_of_symfony_config_resources_used_if_there_arent_any_found(FileLocatorInterface $fileLocator) { $fileLocator->locateFilesNamed('configurationfile.json')->willThrow(\InvalidArgumentException::class); $this->getResources()->shouldReturn([]); }
function it_provides_an_empty_array_if_there_were_no_themes_found(FileLocatorInterface $fileLocator) { $fileLocator->locateFilesNamed('configurationfile.json')->willThrow(\InvalidArgumentException::class); $this->getConfigurations()->shouldReturn([]); }