} //TODO throw Exception as Controller not Existing assert('/*Throw SpiritAbstractorNotFound Exception on path ' . $controller . ' */'); } private function layout($spiritName, $methodName) { $layouts = array(Path::instance()->currentProject("*{$spiritName}.view.-{$methodName}.@layout.php"), Path::instance()->currentProject("*{$spiritName}.view.@layout.php"), Path::instance()->currentProject("*common.view.@layout.php")); foreach ($layouts as $layout) { if (file_exists($layout)) { return $layout; } } //TODO throw Exception as no Layout found Existing assert('/*Throw SpiritLayoutNotFound Exception*/'); print_r($layouts); } private function coordinator($spiritName) { return Path::instance()->currentProject("*{$spiritName}.@coordinator.php"); } public function &_spirits() { return $this->spirits; } public function &_instances() { return $this->instances; } } EngineFactory::register("SpiritEngine");
<?php class AppXMLServiceEngine extends ServiceEngine { public function __construct() { parent::__construct(new MVCEngine(), new XMLDeliveryTrait()); } } EngineFactory::register('AppXMLServiceEngine');
<?php class SpiritXMLServiceEngine extends ServiceEngine { public function __construct() { parent::__construct(new SpiritEngineProxy(), new XMLDeliveryTrait()); } } EngineFactory::register('SpiritXMLServiceEngine');
<?php class SpiritJSONServiceEngine extends ServiceEngine { public function __construct() { parent::__construct(new SpiritEngineProxy(), new JSONDeliveryTrait()); } } EngineFactory::register('SpiritJSONServiceEngine');
<?php class SpiritPropertyServiceEngine extends ServiceEngine { public function __construct() { parent::__construct(new SpiritEngineProxy(), new PropertyDeliveryTrait()); } } EngineFactory::register('SpiritPropertyServiceEngine');
* FIXME Exceptions Not Handled * \algo * $this->responceBuffer: The XSLT as String * $xdoPath: Path to XML DataObject * \endalgo * @param string $xdoPath */ private function processXSLView($xdoPath) { $xdo = new DOMDocument(); $xdo->load($xdoPath); $xslt = new DOMDocument(); if (!@$xslt->loadXML($this->responseBuffer)) { //TODO Handle Exceptions echo $this->responseBuffer; assert("/*Response Malformed Not Parsable as XML TODO Throw Exception*/"); } $transformer = new XSLTProcessor(); if (!@$transformer->importStylesheet($xslt)) { //TODO Handle Exceptions echo $transformer->saveXML(); assert("/*Response Not XSL TODO Throw Exception*/"); } $responseXML = $transformer->transformToDoc($xdo); //Response as a DOMDocument $this->responseBuffer = $responseXML->saveHTML(); //TODO will it be HTML or XML should be decided based upon Content Mime Type } } EngineFactory::register("MVCEngine");
<?php class AppJSONServiceEngine extends ServiceEngine { public function __construct() { parent::__construct(new MVCEngine(), new JSONDeliveryTrait()); } } EngineFactory::register('AppJSONServiceEngine');
<?php class FSMEngine extends ContentEngine { protected function validate() { } public function executeLogic() { } public function run() { $fsm = \FSM\Engine::parse('site'); $path = Path::instance()->evaluate('common') . '/fsm.php'; ob_start(); require $path; $this->responseBuffer = ob_get_contents(); ob_end_clean(); } } EngineFactory::register("FSMEngine");
<?php class AppResponseServiceEngine extends ServiceEngine { public function __construct() { parent::__construct(new MVCEngine(), new ResponseDeliveryTrait()); } } EngineFactory::register('AppResponseServiceEngine');
case 'xslt': http::contentType('text/xml+xslt'); break; case 'scrap': http::contentType('text/plain'); break; default: } switch ($this->navigation->resourceType) { case 'img': $this->responseBuffer = file_get_contents($resourcePath); break; default: ob_start(); require $resourcePath; $this->responseBuffer = ob_get_contents(); ob_end_clean(); } } else { throw new FileNotFoundException($resourcePath ? $resourcePath : 'null <Resource Path Could not be Resolved> '); } } else { throw new ProjectDirNotFoundException($this->projectName); } } else { throw new ProjectNotFoundException($this->projectName); } } } EngineFactory::register('ResourceEngine');
<?php class SpiritResponseServiceEngine extends ServiceEngine { public function __construct() { parent::__construct(new SpiritEngineProxy(), new ResponseDeliveryTrait()); } } EngineFactory::register('SpiritResponseServiceEngine');