/** * Registers Xml definitions to the provided Container. * If no Container is provided, a new one will be created. * * @param string|XmlFile $file Path to Xml (or XmlFile instance) * @param null|Container $container Container where definitions are added * * @return Container */ public function execute($file, Container $container = null) { if (!$file instanceof XmlFile) { $file = new XmlFile($file); } if (null === $container) { $container = new Container(); } $results = $this->map->execute($file); $container->setProperty('packageDir', dirname($file->getRealPath())); $this->applyIniFiles($results['ini'], $container, $file); $this->applyDefinitions($results['definitions'], $container); $this->applyArrayDefinitions($results['arrayDefs'], $container); $this->applyClassDefinitions($results['classDefs'], $container); $this->applyListeners($results['listeners'], $container); return $container; }
/** * Builds an XML Map used to parse services includes (xml) * * @return Map */ protected function xmlServicesMapFactory() { $map = new Map(); $map->add(Path::factory('/fwk/services', 'services', array())->loop(true, '@xml')->attribute('xmlMap')); return $map; }
/** * * @return Map */ protected function xmlActionResultsXmlMapFactory($actionName) { $map = new Map(); $map->add(Path::factory(sprintf("/fwk/actions/action[@name='%s']/result", $actionName), 'results')->loop(true, '@name')->attribute('type')->addChildren(Path::factory('param', 'params')->filter(array($this->descriptor, 'propertizeString'))->loop(true, '@name'))); return $map; }
/** * * @return Map */ protected function xmlRewritesMapFactory(Descriptor $desc) { $map = new Map(); $map->add(Path::factory('/fwk/url-rewrite/url', 'rewrites')->loop(true)->attribute('route')->attribute('action')->addChildren(Path::factory('param', 'params')->loop(true, '@name')->attribute('required')->attribute('regex')->filter(array($desc, 'propertizeString'))->value('value'))); return $map; }
/** * * @return Map */ private function getCommandsXmlMap() { $map = new Map(); $map->add(Path::factory('/fwk/commands/command', 'commands')->loop(true, '@name')->attribute('class')); return $map; }