* @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 * * 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 LocalPaymentDiscovery extends BaseDiscovery implements Discoverable, Registerable { /** * Protected constructor * * @return void */ protected function __construct () { // Call parent constructor parent::__construct(__CLASS__); } /** * Create an instance of this class * * @param $filterInstance An instance of a filter * @return $discoveryInstance An instance of this discovery class */ public static final function createLocalPaymentDiscovery (Filterable $filterInstance) { // Get an instance of this class $discoveryInstance = new LocalPaymentDiscovery(); // Set the action from filter $discoveryInstance->setActionName($filterInstance->getActionName()); // Return the prepared instance return $discoveryInstance; } /** * Discovers the request * * @param $requestInstance An instance of a Requestable class * @return void */ public function discover (Requestable $requestInstance) { // Now get a search criteria and set app name and payment action as search critera $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); $criteriaInstance->addCriteria('app_name', $requestInstance->getRequestElement('app')); $criteriaInstance->addCriteria('payment_action', $this->getActionName() . '_action'); $criteriaInstance->setLimit(1); // Get a wrapper instance $wrapperInstance = ObjectFactory::createObjectByConfiguredName('payment_db_wrapper_class'); // Get result back $resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance); // Advanced to next entry and assert on it as it should always be there assert($resultInstance->valid()); // Set the result instance $this->setResultInstance($resultInstance); } /** * Adds the database result in a human-readable format to the helper class * * @param $helperInstance An instance of a helper class * @return void * @todo 0% done */ public function addResultsToHelper (HelpableTemplate $helperInstance) { // Undone part } } // [EOF] ?>