public function getKeys($routingPath = '') { $parser = new YAMLParser($this->logger); $parser->setFilePath(__SITE_PATH . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . $routingPath); $retval = array(); $config = $parser->loadConfig(); if (is_array($config)) { $retval = $this->parseKeys($config); } $subdirectories = getDirectoryList(); foreach ($subdirectories as $folder) { $parser->setFilePath($folder . '/config/routing.yml'); $config = $parser->loadConfig(); if (is_array($config)) { $retval = array_merge($retval, $this->parseKeys($config)); } } return $retval; }
private function loadConfigurations(YAMLParser $parser) { $subdirectories = $this->getDirectoryList(); $serviceBootstraps = array(); //first load the system service configurations $parser->setFilePath(__SITE_PATH . '/app/config/services.yml'); $config = $parser->loadConfig(); if (is_array($config)) { $this->config[] = $config; } //now load all the component configurations foreach ($subdirectories as $folder) { $parser->setFilePath($folder . '/config/services.yml'); $config = $parser->loadConfig(); if (is_array($config)) { $this->config[] = $config; } } }
private function buildDatasourceInstance($sourceName, Logger $logger) { $parser = new YAMLParser($logger); $ymlFilePath = __SITE_PATH . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'credentials.yml'; $parser->setFilePath($ymlFilePath); $dsConfig = $parser->loadConfig(); $sourceName = trim($sourceName, "<br>"); $datasourceClass = $dsConfig[$sourceName]['class']; $datasource = new $datasourceClass($logger); unset($parser); return $datasource; }
private function loadNodeConfig() { $loader = new YAMLParser($this->logger); $loader->setFilePath(__SITE_PATH . '/app/config/firewall.yml'); $config = $loader->loadConfig(); unset($loader); $parser = new URISectionComparator(); $key = $parser->findPattern($config, __URI); unset($parser); if (empty($key)) { return; } $this->node = $config[$key]; }
public function getFirewallKey(YAMLParser $parser) { $parser->setFilePath(__SITE_PATH . '/app/config/firewall.yml'); $config = $parser->loadConfig(); $comparator = new URISectionComparator(); $key = $comparator->findPattern($config, __URI); if ($key === false) { return null; } if (array_key_exists('authentication', $config[$key])) { return $config[$key]['authentication']; } return null; }
/** * Step 1 * * getInitialRouting determines which of the routing files to refer to for config instructions * * @param string requestURI - the uri we are looking up * * @return string the filepath to use */ public function getInitialRouting($requestURI) { $parser = new YAMLParser($this->logger); $pieces = array_filter(explode('/', $requestURI)); $parser->setFilePath(__SITE_PATH . '/app/config/routing.yml'); $chunk = array_shift($pieces); if ($chunk == 'admin') { $chunk = array_shift($pieces); //drop the admin for the routing file } $config = $parser->loadConfig(); unset($parser); $this->datasources = $config; if (!array_key_exists($chunk, $config)) { throw new URINotFoundException($chunk . ' does not exist in YML configuration'); } //return the first path foreach ($config[$chunk] as $key => $path) { return $path; } }
private function loadEncodingConfiguration() { $loader = new YAMLParser($this->logger); $loader->setFilePath(__NAMESPACE . DIRECTORY_SEPARATOR . __COMPONENT_FOLDER . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'encodings.yml'); $config = $loader->loadConfig(); unset($loader); return $config; }