public function __construct()
 {
     $newLinesFilters = function ($line) {
         return str_replace("\n", " ", $line);
     };
     $this->add(Path::factory('/TS/context', 'contexts', array())->addChildren(Path::factory('message', 'messages', array())->addChildren(Path::factory('source', 'source', null, $newLinesFilters))->addChildren(Path::factory('translation', 'translation', null, $newLinesFilters))->loop(true))->loop(true, 'name'));
 }
Beispiel #2
0
 /**
  * Constructor
  * 
  * Initialize Map paths to return an array of definitions
  * 
  * @void
  */
 public function __construct()
 {
     $this->add(Path::factory('/dependency-injection/class-definition', 'classDefs', array())->loop(true, '@name')->attribute('shared')->attribute('lazy')->attribute('class', 'className')->addChildren(Path::factory('argument', 'arguments', array())->loop(true)->value('value'))->addChildren(Path::factory('call', 'methodsCalls', array())->loop(true)->attribute('method')->addChildren(Path::factory('argument', 'arguments', array())->loop(true)->value('value')))->addChildren(Path::factory('data/param', 'data', array())->loop(true, '@key')->value('value')));
     $this->add(Path::factory('/dependency-injection/definition', 'definitions', array())->loop(true, '@name')->attribute('shared')->value('value'));
     $this->add(Path::factory('/dependency-injection/ini', 'ini', array())->loop(true)->attribute('category')->value('value'));
     $this->add(Path::factory('/dependency-injection/array-definition', 'arrayDefs', array())->loop(true, '@name')->attribute('shared')->addChildren(Path::factory('param', 'params', array())->loop(true)->attribute('key')->value('value'))->addChildren(Path::factory('data/param', 'data', array())->loop(true, '@key')->value('value')));
     $this->add(Path::factory('/dependency-injection/listener', 'listeners', array())->loop(true)->attribute('class')->attribute('service'));
 }
Beispiel #3
0
 /**
  * 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;
 }
Beispiel #4
0
 /**
  *
  * @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;
 }
Beispiel #5
0
 /**
  *
  * @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;
 }
Beispiel #6
0
Datei: Map.php Projekt: fwk/xml
 /**
  * Returns childrens values
  *
  * @param Path             $path Current Path
  * @param SimpleXMLElement $node Current SimpleXML node
  *
  * @return array
  */
 protected function getChildrens(Path $path, SimpleXMLElement $node)
 {
     $current = array();
     foreach ($path->getChildrens() as $child) {
         $key = $child->getKey();
         $csxml = $node->xpath($child->getXpath());
         $val = $child->getDefault();
         if (is_array($csxml) && count($csxml)) {
             $val = $this->pathToValue($csxml, $child);
         }
         $current[$key] = $val;
         if ($val === null && $child->isLoop()) {
             $current[$key] = array();
         }
     }
     return $current;
 }
Beispiel #7
0
Datei: Rss.php Projekt: fwk/xml
 /**
  * Constructor
  * 
  * @return void
  */
 public function __construct()
 {
     $this->add(Path::factory('/rss/channel', 'channel')->addChildren(Path::factory('title', 'title'))->addChildren(Path::factory('link', 'link'))->addChildren(Path::factory('description', 'description'))->addChildren(Path::factory('language', 'language'))->addChildren(Path::factory('lastBuildDate', 'lastBuildDate'))->addChildren(Path::factory('sy:updatePeriod', 'updatePeriod'))->addChildren(Path::factory('sy:updateFrequency', 'updateFrequency'))->addChildren(Path::factory('generator', 'generator'))->addChildren(Path::factory('image', 'image')->addChildren(Path::factory('link', 'link'))->addChildren(Path::factory('url', 'url'))->addChildren(Path::factory('title', 'title'))));
     $this->add(Path::factory('/rss/channel/item', 'items')->loop(true)->addChildren(Path::factory('title', 'title'))->addChildren(Path::factory('link', 'link'))->addChildren(Path::factory('comments', 'comments'))->addChildren(Path::factory('pubDate', 'pubDate'))->addChildren(Path::factory('dc:creator', 'creator'))->addChildren(Path::factory('category', 'categories')->loop(true))->addChildren(Path::factory('guid', 'guid')->attribute('isPermaLink', 'permalink')->value('value'))->addChildren(Path::factory('description', 'description'))->addChildren(Path::factory('media:thumbnail', 'thumbnail')->attribute('url')));
 }
Beispiel #8
0
 /**
  *
  * @return Map
  */
 private function getCommandsXmlMap()
 {
     $map = new Map();
     $map->add(Path::factory('/fwk/commands/command', 'commands')->loop(true, '@name')->attribute('class'));
     return $map;
 }