|
[PHP-DOC] PhD Processing Instructions Design: msg#00135phpdoc
Hey guys, The first design of the PhD Processing Instructions Handler. The idea is choose the correct PIHandler class for each target you want. ex: In the Package_Default_XHTML class we have: $pihandlers = array( "dbhtml" => "PI_DBHTMLHandler", ); In your own package: $pihandlers = array( "dbhtml" => "MyOwnDBHTMLHandler", ); Also we can write a class to handler all targets: $pihandlers = array( "dbhtml" => "PIHandler", "dbman" => "PIHandler", "tdg-purp" => "PIHandler", ); The Render class will only know the parsePI method: case \XMLReader::PI: $target = $r->name; $data = ""> foreach ($this as $format) { $format->parsePI($target, $data); } break; The parsePI method will act like a factory to instanciate the PIHandler class: public final function parsePI($target, $data) { if (isset($this->pihandlers[$target])) { //I'm thinking in a way to not have to create a new instance here //every time. Maybe a singleton? $classname = __NAMESPACE__ . "\\" . $this->pihandlers[$target]; $pihandler = new $classname($this); return $pihandler->parse($data); } } The PIHandler classes will have to parse and process the data in the PI. Sugestions? --Moacir
|
|
||||||||||||||||||||||||||
| News | Mail Home | sitemap | FAQ | advertise |