* @version 0.0.0 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @todo This template engine does not make use of setTemplateType() * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ class XmlCruncherTestUnitTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable { /** * Protected constructor * * @return void */ protected function __construct () { // Call parent constructor parent::__construct(__CLASS__); // Init sub nodes $this->subNodes = array( 'meta-data', 'global-project-identifier', 'test-unit-created', 'cipher', 'cipher-function', 'cipher-name', 'unprocessed-data', 'encrypted-message', 'cruncher-key-list', 'cruncher-key', 'key-id', 'key-value' ); } /** * Creates an instance of the class TemplateEngine and prepares it for usage * * @return $templateInstance An instance of TemplateEngine * @throws BasePathIsEmptyException If the provided $templateBasePath is empty * @throws InvalidBasePathStringException If $templateBasePath is no string * @throws BasePathIsNoDirectoryException If $templateBasePath is no * directory or not found * @throws BasePathReadProtectedException If $templateBasePath is * read-protected */ public static final function createXmlCruncherTestUnitTemplateEngine () { // Get a new instance $templateInstance = new XmlCruncherTestUnitTemplateEngine(); // Init template instance $templateInstance->initXmlTemplateEngine('cruncher', 'test_unit'); // Return the prepared instance return $templateInstance; } /** * Load a specified cruncher_test_unit template into the engine * * @param $template The cruncher_test_unit template we shall load which is * located in 'cruncher_test_unit' by default * @return void */ public function loadCruncherTestUnitTemplate ($template) { // Set template type $this->setTemplateType($this->getConfigInstance()->getConfigEntry('cruncher_test_unit_template_type')); // Load the special template $this->loadTemplate($template); } /** * Currently not used * * @param $resource XML parser resource (currently ignored) * @param $characters Characters to handle * @return void */ public function characterHandler ($resource, $characters) { // Trim all spaces away $characters = trim($characters); // Is this string empty? if (empty($characters)) { // Then skip it silently return false; } // END - if // Assign the found characters to variable and use the last entry from // stack as the name parent::assignVariable($this->getStackerInstance()->getNamed('cruncher_test_unit'), $characters); } /** * Getter for cache file (FQFN) * * @return $fqfn Full-qualified file name of the menu cache */ public function getCruncherTestUnitCacheFqfn () { $this->partialStub('Please implement this method.'); } /** * Starts the test-unit * * @return void */ private function startCruncherTestUnit () { // Push the node name on the stacker $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'cruncher-test-unit'); } /** * Starts the meta-data * * @return void */ private function startMetaData () { // Push the node name on the stacker $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'meta-data'); } /** * Starts the global-project-identifier * * @return void */ private function startGlobalProjectIdentifier () { // Push the node name on the stacker $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'global-project-identifier'); } /** * Finishes the global-project-identifier * * @return void */ private function finishGlobalProjectIdentifier () { // Pop the last entry $this->getStackerInstance()->popNamed('cruncher_test_unit'); } /** * Starts the test-unit-created * * @return void */ private function startTestUnitCreated () { // Push the node name on the stacker $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'test-unit-created'); } /** * Finishes the test-unit-created * * @return void */ private function finishTestUnitCreated () { // Pop the last entry $this->getStackerInstance()->popNamed('cruncher_test_unit'); } /** * Starts the cipher * * @return void */ private function startCipher () { // Push the node name on the stacker $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'cipher'); } /** * Starts the cipher-function * * @return void */ private function startCipherFunction () { // Push the node name on the stacker $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'cipher-function'); } /** * Finishes the cipher-function * * @return void */ private function finishCipherFunction () { // Pop the last entry $this->getStackerInstance()->popNamed('cruncher_test_unit'); } /** * Starts the cipher-name * * @return void */ private function startCipherName () { // Push the node name on the stacker $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'cipher-name'); } /** * Finishes the cipher-name * * @return void */ private function finishCipherName () { // Pop the last entry $this->getStackerInstance()->popNamed('cruncher_test_unit'); } /** * Finishes the cipher * * @return void */ private function finishCipher () { // Pop the last entry $this->getStackerInstance()->popNamed('cruncher_test_unit'); } /** * Finishes the meta-data * * @return void */ private function finishMetaData () { // Pop the last entry $this->getStackerInstance()->popNamed('cruncher_test_unit'); } /** * Starts the unprocessed-data * * @return void */ private function startUnprocessedData () { // Push the node name on the stacker $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'unprocessed-data'); } /** * Starts the encrypted-message * * @return void */ private function startEncryptedMessage () { // Push the node name on the stacker $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'encrypted-message'); } /** * Finishes the encrypted-message * * @return void */ private function finishEncryptedMessage () { // Pop the last entry $this->getStackerInstance()->popNamed('cruncher_test_unit'); } /** * Starts the cruncher-key-list * * @param $keyCount Count of keys in this test unit * @return void * @todo Handle $keyCount */ private function startCruncherKeyList ($keyCount) { // Push the node name on the stacker $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'cruncher-key-list'); } /** * Starts the cruncher-key * * @return void */ private function startCruncherKey () { // Push the node name on the stacker $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'cruncher-key'); } /** * Starts the key-id * * @return void */ private function startKeyId () { // Push the node name on the stacker $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'key-id'); } /** * Finishes the key-id * * @return void */ private function finishKeyId () { // Pop the last entry $this->getStackerInstance()->popNamed('cruncher_test_unit'); } /** * Starts the key-value * * @return void */ private function startKeyValue () { // Push the node name on the stacker $this->getStackerInstance()->pushNamed('cruncher_test_unit', 'key-value'); } /** * Finishes the key-value * * @return void */ private function finishKeyValue () { // Pop the last entry $this->getStackerInstance()->popNamed('cruncher_test_unit'); } /** * Finishes the cruncher-key * * @return void */ private function finishCruncherKey () { // Pop the last entry $this->getStackerInstance()->popNamed('cruncher_test_unit'); } /** * Finishes the cruncher-key-list * * @return void */ private function finishCruncherKeyList () { // Pop the last entry $this->getStackerInstance()->popNamed('cruncher_test_unit'); } /** * Finishes the unprocessed-data * * @return void */ private function finishUnprocessedData () { // Pop the last entry $this->getStackerInstance()->popNamed('cruncher_test_unit'); } /** * Finishes the test-unit * * @return void */ private function finishCruncherTestUnit () { // Pop the last entry $this->getStackerInstance()->popNamed('cruncher_test_unit'); } } // [EOF] ?>