* returns an object holding all available payment system for the requested
* type.
*
- * @author Roland Haeder <webmaster@ship-simu.org>
+ * @author Roland Haeder <webmaster@shipsimu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007 - 2009 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
* @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
+ * @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
/**
* Action name for payment discovery
*/
- private $actionName = "";
+ private $actionName = '';
/**
* Protected constructor
* @return $filterInstance An instance of this filter class
* @throws NullPointerException If the resolver is not set
*/
- public final static function createPaymentDiscoveryFilter (PerformableAction $actionInstance) {
+ public static final function createPaymentDiscoveryFilter (PerformableAction $actionInstance) {
// Get a new instance
$filterInstance = new PaymentDiscoveryFilter();
* @param $responseInstance An instance of a class with an Responseable interface
* @return void
* @todo 0% done
+ * @throws FilterChainException If this filter fails to operate
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
// Try to get real discovery class
try {
// Get an instance from the object factory
- $discoveryInstance = ObjectFactory::createObjectByConfiguredName($this->getActionName().'_payment_discovery', array($this));
+ $discoveryInstance = ObjectFactory::createObjectByConfiguredName($this->getActionName() . '_payment_discovery', array($this));
// Call the discovery method
$discoveryInstance->discover($requestInstance);
// Remember this instance if all wents fine
Registry::getRegistry()->addInstance('payments', $discoveryInstance);
- } catch (ConfigEntryNotFoundException $e) {
+ } catch (NoConfigEntryException $e) {
// Something bad happend
- $requestInstance->requestIsValid(false);
+ $requestInstance->requestIsValid(FALSE);
// Add a message to the response
$responseInstance->addFatalMessage('payment_config_entry_error');
$responseInstance->addFatalMessagePlain($e->getMessage());
// Abort here
- return false;
- } catch (ClassNotFoundException $e) {
+ throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED);
+ } catch (NoClassException $e) {
// Something bad happend
- $requestInstance->requestIsValid(false);
+ $requestInstance->requestIsValid(FALSE);
// Add a message to the response
$responseInstance->addFatalMessage('payment_class_error');
$responseInstance->addFatalMessagePlain($e->getMessage());
// Abort here
- return false;
+ throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED);
}
}
}