// Import framework stuff
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
+use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
use Org\Mxchange\CoreFramework\Generic\NullPointerException;
use Org\Mxchange\CoreFramework\Helper\Helper;
use Org\Mxchange\CoreFramework\Registry\Registerable;
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
if (!$this->isValidSocket()) {
// Throw exception
- throw new BadMethodCallException(sprintf('[%s:%d]: Shutdown on invalid socket. Maybe called already?', __METHOD__, __LINE__), self::EXCEPTION_INVALID_SOCKET);
+ throw new BadMethodCallException(sprintf('[%s:%d]: Shutdown on invalid socket. Maybe called already?', __METHOD__, __LINE__), self::EXCEPTION_INVALID_SOCKET, FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
}
// Debug message
throw new InvalidSocketException([$this], self::EXCEPTION_INVALID_SOCKET);
} elseif ($this->getLastSocketErrorCode() === 0) {
// Nothing to clear
- throw new BadMethodCallException(sprintf('Socket "%s" has no error reported, but method is called.', $this->getSocketResource()));
+ throw new BadMethodCallException(sprintf('Socket "%s" has no error reported, but method is called.', $this->getSocketResource()), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
}
// Clear last error
use Org\Mxchange\CoreFramework\Criteria\Local\LocalSearchCriteria;
use Org\Mxchange\CoreFramework\Criteria\Storing\StoreableCriteria;
use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
+use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
use Org\Mxchange\CoreFramework\Handler\DataSet\HandleableDataSet;
use Org\Mxchange\CoreFramework\Registry\Registerable;
use Org\Mxchange\CoreFramework\Result\Search\SearchableResult;
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-FRONTEND: CALLED!');
if (!$this->isLocalNodeRegistered()) {
// Not registered but methoded invoked
- throw new BadMethodCallException('Node is not locally registered but method called');
+ throw new BadMethodCallException('Node is not locally registered but method called', FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
}
// Get search criteria
use Org\Shipsimu\Hub\Handler\Package\NetworkPackageHandler;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
use Org\Mxchange\CoreFramework\Registry\Registerable;
// Import SPL stuff
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-DECODER: CALLED!');
if (!$this->ifUnhandledRawPackageDataLeft()) {
// No unhandled package data pending
- throw new BadMethodCallException('No unhandled package data is pending but method called');
+ throw new BadMethodCallException('No unhandled package data is pending but method called', FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
}
// "Pop" the next raw package content
// Check condition
if (!$this->ifDeocedPackagesLeft()) {
// No decoded packages left
- throw new BadMethodCallException('No decoded packages pending but method called');
+ throw new BadMethodCallException('No decoded packages pending but method called', FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
}
// Get the next entry (assoziative array)
// Import framework stuff
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
+use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
use Org\Mxchange\CoreFramework\Result\Search\SearchableResult;
use Org\Mxchange\CoreFramework\Traits\Stack\StackableTrait;
use Org\Mxchange\CoreFramework\Traits\State\StateableTrait;
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DHT: CALLED!');
if (!$this->hasEntriesPendingPublication()) {
// Bad invocation
- throw new BadMethodCallException('Has no entries pending publication but method was called.');
+ throw new BadMethodCallException('Has no entries pending publication but method was called.', FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
}
// Is there an instance?
use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
use Org\Mxchange\CoreFramework\Factory\Registry\Socket\SocketRegistryFactory;
use Org\Mxchange\CoreFramework\Feature\FrameworkFeature;
+use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
use Org\Mxchange\CoreFramework\Generic\NullPointerException;
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
use Org\Mxchange\CoreFramework\Registry\Registerable;
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: CALLED!');
if (!$this->isEncodedDataPending()) {
// Throw exception
- throw new BadMethodCallException('No encoded data is pending but this method was called.');
+ throw new BadMethodCallException('No encoded data is pending but this method was called.', FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
}
// Pop current data from stack
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: CALLED!');
if (!$this->isRawDataPending()) {
// Should not be invoked anymore
- throw new BadMethodCallException('No incoming decoded data on stack but method was called.');
+ throw new BadMethodCallException('No incoming decoded data on stack but method was called.', FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
}
// "Pop" the next entry (the same array again) from the stack
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: CALLED!');
if (!$this->isNewMessageArrived()) {
// Bad method call
- throw new BadMethodCallException('No new message arrived but this method has been called.');
+ throw new BadMethodCallException('No new message arrived but this method has been called.', FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
}
// Get it from the stacker, it is the full array with the decoded message
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: CALLED!');
if (!$this->isDecodedPackageXmlPending()) {
// Bad method call
- throw new BadMethodCallException('No package waiting XML parsing');
+ throw new BadMethodCallException('No package waiting XML parsing', FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
}
// Get it from the stacker, it is the full array with the decoded package (raw XML)
use Org\Shipsimu\Hub\Locator\Node\Tools\NodeLocatorUtils;
use Org\Shipsimu\Hub\Network\Package\DeliverablePackage;
+// Import framework-specific stuff
+use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
+
// Import SPL stuff
use \BadMethodCallException;
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('IPV4-PROTOCOL-HANDLER: packageInstance=%s - CALLED!', $packageInstance->__toString()));
if (substr($packageInstance->getRecipientUnl(), 0, strlen($this->getProtocolName())) != $this->getProtocolName()) {
// Not matching, throw exception
- throw new BadMethodCallException(sprintf('packageInstance->recipientUnl=%s cannot be handled by this protocol handler (%s)', $packageInstance->getRecipientUnl(), $this->getProtocolName()));
+ throw new BadMethodCallException(sprintf('packageInstance->recipientUnl=%s cannot be handled by this protocol handler (%s)', $packageInstance->getRecipientUnl(), $this->getProtocolName()), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
}
// Default is from generic validation
// Import framework stuff
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
use Org\Mxchange\CoreFramework\Traits\Handler\HandleableTrait;
// Import SPL stuff
//* DEBUG-DIE: */ die(__METHOD__.':socketInstance='.print_r($this->getSocketInstance(), TRUE));
if (!$this->isInitialized()) {
// Bad method call
- throw new BadMethodCallException(sprintf('BASE-IPV4-CONNECTION-HELPER: protocolName=%s is not yet initialized.', $this->getProtocolName()));
+ throw new BadMethodCallException(sprintf('BASE-IPV4-CONNECTION-HELPER: protocolName=%s is not yet initialized.', $this->getProtocolName()), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
}
// "Cache" socket resource and timeout config
use Org\Shipsimu\Hub\Tools\HubTools;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
use Org\Mxchange\CoreFramework\Registry\Registerable;
// Import SPL stuff
throw new MissingArrayElementsException(array($this, 'unlData', array(NodeInformationDatabaseFrontend::DB_COLUMN_EXTERNAL_UNL)), self::EXCEPTION_ARRAY_ELEMENTS_MISSING);
} elseif ($unlData[NodeInformationDatabaseFrontend::DB_COLUMN_EXTERNAL_UNL] == 'invalid') {
// Is not valid/method to early used
- throw new BadMethodCallException(sprintf('unlData[%s] is invalid. Maybe called this method to early?', NodeInformationDatabaseFrontend::DB_COLUMN_EXTERNAL_UNL));
+ throw new BadMethodCallException(sprintf('unlData[%s] is invalid. Maybe called this method to early?', NodeInformationDatabaseFrontend::DB_COLUMN_EXTERNAL_UNL), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
}
// Return it
throw new MissingArrayElementsException(array($this, 'unlData', array(NodeInformationDatabaseFrontend::DB_COLUMN_INTERNAL_UNL)), self::EXCEPTION_ARRAY_ELEMENTS_MISSING);
} elseif ($unlData[NodeInformationDatabaseFrontend::DB_COLUMN_INTERNAL_UNL] == 'invalid') {
// Is not valid/method to early used
- throw new BadMethodCallException(sprintf('unlData[%s] is invalid. Maybe called this method to early?', NodeInformationDatabaseFrontend::DB_COLUMN_INTERNAL_UNL));
+ throw new BadMethodCallException(sprintf('unlData[%s] is invalid. Maybe called this method to early?', NodeInformationDatabaseFrontend::DB_COLUMN_INTERNAL_UNL), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
}
// Return it
// Import framework stuff
use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
+use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
use Org\Mxchange\CoreFramework\Registry\Registerable;
use Org\Mxchange\CoreFramework\Traits\Handler\HandleableTrait;
use Org\Mxchange\CoreFramework\Traits\Stack\StackableTrait;
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: Going to decode ' . strlen($this->pendingData) . ' Bytes of pending data. pendingData=' . $this->pendingData);
if ($this->isPendingDataEmpty()) {
// Should not happen
- throw new BadMethodCallException('this->pendingData is empty but method was called..');
+ throw new BadMethodCallException('this->pendingData is empty but method was called..', FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
}
// No markers set?
// Validate conditions
if (!$this->ifMultipleMessagesPending()) {
// Opps?
- throw new BadMethodCallException('No multiple messages are pending but method called');
+ throw new BadMethodCallException('No multiple messages are pending but method called', FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
} elseif (!$this->isPendingDataEmpty()) {
// Pending data is not empty but invoked
- throw new BadMethodCallException(sprintf('this->pendingData()=%d still filled but method called', strlen($this->pendingData)));
+ throw new BadMethodCallException(sprintf('this->pendingData()=%d still filled but method called', strlen($this->pendingData)), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
}
// "Pop" next entry from stack and set it as new pending data