use Org\Shipsimu\Hub\Listener\BaseListener;
use Org\Shipsimu\Hub\Listener\Listenable;
use Org\Shipsimu\Hub\Locator\Node\LocateableNode;
-use Org\Shipsimu\Hub\Miner\Minable;
use Org\Shipsimu\Hub\Network\Delivery\Deliverable;
use Org\Shipsimu\Hub\Network\Package\DeliverablePackage;
use Org\Shipsimu\Hub\Network\Package\Delivery\Fragment\Fragmentable;
*/
private $packageInstance = NULL;
- /**
- * A Minable instance
- */
- private $minableInstance = NULL;
-
/**
* Name of used protocol
*/
* @param $privateKey The new private key
* @return void
*/
- protected final function setPrivateKey ($privateKey) {
+ protected final function setPrivateKey (string $privateKey) {
// Set it config now
$this->getConfigInstance()->setConfigEntry('private_key', (string) $privateKey);
}
* @param $privateKeyHash The new private key hash
* @return void
*/
- protected final function setNodePrivateKeyHash ($privateKeyHash) {
+ protected final function setNodePrivateKeyHash (string $privateKeyHash) {
// Set it config now
- $this->getConfigInstance()->setConfigEntry('private_key_hash', (string) $privateKeyHash);
+ $this->getConfigInstance()->setConfigEntry('private_key_hash', $privateKeyHash);
}
/**
* @param $sessionId The new session id
* @return void
*/
- protected final function setSessionId ($sessionId) {
- $this->getConfigInstance()->setConfigEntry('session_id', (string) $sessionId);
+ protected final function setSessionId (string $sessionId) {
+ $this->getConfigInstance()->setConfigEntry('session_id', $sessionId);
}
/**
return $this->packageInstance;
}
- /**
- * Setter for Minable instance
- *
- * @param $minableInstance A Minable instance
- * @return void
- */
- protected final function setMinableInstance (Minable $minableInstance) {
- $this->minableInstance = $minableInstance;
- }
-
- /**
- * Getter for minable instance
- *
- * @return $minableInstance A Minable instance
- */
- protected final function getMinableInstance () {
- return $this->minableInstance;
- }
-
}
*
* @param $peerSuffix Suffix for peer name (e.g. :0 for TCP(/UDP?) connections)
* @return void
- * @throws InvalidArgumentException If $peerSuffix is empty
* @throws LogicException If no info instance can be created
*/
protected function doListenSocketSelect (string $peerSuffix) {
// Validate parameter and socket instance
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: peerSuffix=%s - CALLED!', strtoupper($this->getProtocolName()), $peerSuffix));
- if (empty($peerSuffix)) {
- // Throw exception
- throw new InvalidArgumentException('peerSuffix is empty');
- } elseif(!$this->getSocketInstance()->isValidSocket()) {
+ if(!$this->getSocketInstance()->isValidSocket()) {
// Invalid socket
throw new LogicException(sprintf('this->socketInstance->socketResource=%s is not valid', $this->getSocketInstance()->getSocketResource()));
}
namespace Org\Shipsimu\Hub\Producer\Miner;
// Import application-specific stuff
+use Org\Shipsimu\Hub\Miner\Minable;
use Org\Shipsimu\Hub\Producer\BaseProducer;
// Import framework stuff
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseMinerProducer extends BaseProducer {
+
+ /**
+ * A Minable instance
+ */
+ private $minableInstance = NULL;
+
/**
* Protected constructor
*
$minerInstance->blockProducerHasInitialized($this);
}
+ /**
+ * Setter for Minable instance
+ *
+ * @param $minableInstance A Minable instance
+ * @return void
+ */
+ protected final function setMinableInstance (Minable $minableInstance) {
+ $this->minableInstance = $minableInstance;
+ }
+
+ /**
+ * Getter for minable instance
+ *
+ * @return $minableInstance A Minable instance
+ */
+ protected final function getMinableInstance () {
+ return $this->minableInstance;
+ }
+
}