* @version 0.0.0 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.shipsimu.org * * 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 CryptoRandomUnitMessageHelper extends BaseMessageHelper implements MessageHelper { /** * Protected constructor * * @return void */ protected function __construct () { // Call parent constructor parent::__construct(__CLASS__); } /** * Creates an instance of this class * * @param $sourceType Type of the source * @return $messageInstance An instance of a UnitHelper class */ public final static function createCryptoRandomUnitMessageHelper ($sourceType) { // Get new instance $messageInstance = new CryptoRandomUnitMessageHelper(); // Generate a source instance $sourceInstance = UnitSourceFactory::createUnitSourceInstance($sourceType); // Set the source instance $messageInstance->setSourceInstance($sourceInstance); // Return the prepared instance return $messageInstance; } /** * Generates an encrypted random message * * @return $encryptedMessage The encrypted random message */ public function generateRandomMessage () { // Get the message from our source $encryptedMessage = $this->getSourceInstance()->generateMessageFromSource(); // Return it return $encryptedMessage; } /** * "Getter" for an iterator for keys * * @return $iteratorInstance An instance of a Iterator class */ public function getKeyIterator () { // Create the iterator instance $iteratorInstance = ObjectFactory::createObjectByConfiguredName('test_unit_producer_key_iterator_class'); // And return it return $iteratorInstance; } } // [EOF] ?>