/** * format - prune the registry based on xml config * * @param string XMLpath * @param Registry registry * * @return array */ public static function format(YAMLConfiguration $params, HTTPRequest $request, HTTPResponse &$response, Logger $logger) { $attributes = $request->getAttributes(); $output = array(); if (count($params) < 1) { if (self::PARANOID_MODE) { $logger->addError('XML is missing CherryPicker configs for ' . $uri); throw new XMLNodeNotConfiguredException('need to customize error for YAML configs for ' . $uri); } //not paranoid? ok - dump the whole registry to the user foreach ($attributes as $key => $value) { $output[self::trimNamespacing($key)] = $attributes[$key]; } return $output; } $configs = array_filter($params->getConfigs()); foreach ($configs as $key => $outputSet) { // pr($outputSet); // exit; foreach ($outputSet as $className => $columns) { if (is_array($outputSet)) { self::formatArray($className, $columns, $output, $attributes, $logger); } } } $response = new HTTPResponse($output); }
public function __construct(Logger $logger, $ymlKey, array $agentType, HTTPRequest $httpRequest) { $this->logger = $logger; $this->ymlKey = $ymlKey; $this->agentType = $agentType; $this->langFileLoader = $httpRequest->getAttribute('langFiles'); $this->localesList = $httpRequest->getAttribute('locales'); $this->httpRequest = $httpRequest; $this->loadConfig(); }