use Org\Mxchange\CoreFramework\Registry\Registerable;
use Org\Mxchange\CoreFramework\Result\Search\SearchableResult;
+// Import SPL stuff
+use \InvalidArgumentException;
+
/**
* A database wrapper for distributed hash tables
*
*
* @param $sessionId Session id to lookup
* @return $resultInstance An instance of a SearchableResult class
+ * @throws InvalidArgumentException If parameter $sessionId is not valid
*/
public function findNodeLocalBySessionId ($sessionId) {
+ // Validate parameter
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('DHT-WRAPPER: sessionId=%s - CALLED!', $sessionId));
+ if (empty($sessionId)) {
+ // Cannot be empty
+ throw new InvalidArgumentException('Parameter "sessionId" is empty.');
+ }
+
// Get search criteria
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: sessionId=' . $sessionId . ' - CALLED!');
$searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
// Search for session id and limit it to one entry
use Org\Mxchange\CoreFramework\Registry\Registerable;
use Org\Mxchange\CoreFramework\Result\Search\SearchableResult;
+// Import SPL stuff
+use \InvalidArgumentException;
+
/**
* A Node DHT facade class
*
* @return $nodeData Node-data array
*/
public function findNodeLocalBySessionId ($sessionId) {
- // Default is empty data array
+ // Validate parameter
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: sessionId=%s - CALLED!', $sessionId));
+ if (empty($sessionId)) {
+ // Cannot be empty
+ throw new InvalidArgumentException('Parameter "sessionId" is empty.');
+ }
+
+ // Default is empty data array
$nodeData = array();
/*
*
* @param $sessionId Session id to lookup
* @return $resultInstance An instance of a SearchableResult class
+ * @throws InvalidArgumentException If parameter $sessionId is not valid
*/
function findNodeLocalBySessionId ($sessionId);
*
* @param $sessionId Session id to lookup
* @return $nodeData Node-data array
+ * @throws InvalidArgumentException If parameter $sessionId is not valid
*/
function findNodeLocalBySessionId ($sessionId);