ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
FactoriesCrawler.php
Go to the documentation of this file.
1<?php
2/***
3 * @author Timon Amstutz <timon.amstutz@ilub.unibe.ch>
4 * @version $Id$
5 *
6 */
8
11
12class FactoriesCrawler implements Crawler
13{
17 protected $parser = null;
18
22 protected $ef = null;
23
27 public function __construct(){
28 $this->parser = new EntriesYamlParser();
29 $this->ef = new Exception\Factory();
30 }
31
35 public function crawlFactory($factoryPath,Entry\ComponentEntry $parent = null,$depth=0){
36 $depth++;
37 if($depth > 30){
38 throw $this->ef->exception(Exception\CrawlerException::CRAWL_MAX_NESTING_REACHED," Current Path: ".$factoryPath." Parent: ".$parent->getId());
39 }
40 $entries = $this->parser->parseEntriesFromFile($factoryPath);
41
42 $children = new Entry\ComponentEntries();
43
44 foreach($entries as $entry){
45 if($entry->isAbstract()){
46 $children->addEntries($this->crawlFactory($entry->getPath().".php",$entry,$depth));
47 }
48 if($parent){
49 $entry->setParent($parent->getId());
50 $parent->addChild($entry->getId());
51 }
52 }
53 $entries->addEntries($children);
54 return $entries;
55 }
56
57
58}
59?>
An exception for terminatinating execution or to throw for unit testing.
Container storing a list of UI Component Entries, can act as Iterator, countable and is serializable.
crawlFactory($factoryPath, Entry\ComponentEntry $parent=null, $depth=0)
Starts with the factory indicated by factory path and crawles form this point all all subsequent fact...