]> git.mxchange.org Git - hub.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 6 Jul 2025 22:29:48 +0000 (00:29 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 6 Jul 2025 22:29:48 +0000 (00:29 +0200)
- changed deprecated `EmptyVariableException` to `InvalidArgumentException`
- changed old array() to "new" [] style
- updated 'core' framework

25 files changed:
application/hub/classes/container/socket/class_SocketContainer.php
application/hub/classes/database/frontend/node_dht/class_NodeDistributedHashTableDatabaseFrontend.php
application/hub/classes/database/frontend/states/class_PeerStateLookupDatabaseFrontend.php
application/hub/classes/dht/node/class_NodeDhtFacade.php
application/hub/classes/factories/states/communicator/class_CommunicatorStateFactory.php
application/hub/classes/factories/states/node/class_NodeStateFactory.php
application/hub/classes/handler/chunks/class_ChunkHandler.php
application/hub/classes/handler/data/message-types/announcement/class_NodeMessageAnnouncementHandler.php
application/hub/classes/handler/data/message-types/answer/class_NodeMessageAnnouncementAnswerHandler.php
application/hub/classes/handler/data/message-types/answer/class_NodeMessageDhtBootstrapAnswerHandler.php
application/hub/classes/handler/data/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php
application/hub/classes/handler/data/message-types/dht/class_NodeMessageDhtBootstrapHandler.php
application/hub/classes/handler/data/message-types/requests/class_NodeMessageRequestNodeListHandler.php
application/hub/classes/handler/package/class_NetworkPackageHandler.php
application/hub/classes/locator/class_UniversalNodeLocator.php
application/hub/classes/package/assembler/class_PackageAssembler.php
application/hub/classes/pools/peer/class_DefaultPeerPool.php
application/hub/classes/resolver/command/console/class_HubConsoleCommandResolver.php
application/hub/classes/resolver/command/html/class_HubHtmlCommandResolver.php
application/hub/classes/resolver/controller/console/class_HubConsoleControllerResolver.php
application/hub/classes/resolver/controller/html/class_HubHtmlControllerResolver.php
application/hub/classes/resolver/state/class_BaseStateResolver.php
application/hub/classes/tags/package/class_PackageTags.php
application/hub/interfaces/resolver/state/class_StateResolver.php
core

index 6e6ca46ce85a265713c59d79deebd0da2489d6d4..deb1f36fed0f4f94d995957fb835ee27249c1864 100644 (file)
@@ -1073,7 +1073,7 @@ class SocketContainer extends BaseHubContainer implements StorableSocket, Visita
                // Is the call-back method there?
                if (!method_exists($this, $handlerName)) {
                        // Please implement this
-                       throw new UnsupportedSocketErrorHandlerException(array($this, $handlerName, $errorCode), BaseConnectionHelper::EXCEPTION_UNSUPPORTED_ERROR_HANDLER);
+                       throw new UnsupportedSocketErrorHandlerException([$this, $handlerName, $errorCode], BaseConnectionHelper::EXCEPTION_UNSUPPORTED_ERROR_HANDLER);
                }
 
                // Return it
index c61af61024f76810403472efe97990b82b2c7361..a00289b8dee9cb6a00ad515e96bac316e713f997 100644 (file)
@@ -484,7 +484,7 @@ class NodeDistributedHashTableDatabaseFrontend extends BaseHubDatabaseFrontend i
                // Is the node registered?
                if ($this->isNodeRegistered($nodeData)) {
                        // Throw an exception
-                       throw new NodeAlreadyRegisteredException(array($this, $nodeData), self::EXCEPTION_NODE_ALREADY_REGISTERED);
+                       throw new NodeAlreadyRegisteredException([$this, $nodeData], self::EXCEPTION_NODE_ALREADY_REGISTERED);
                }
 
                // @TODO Unimplemented part
@@ -517,7 +517,7 @@ class NodeDistributedHashTableDatabaseFrontend extends BaseHubDatabaseFrontend i
                // Is the node registered?
                if (!$this->isNodeRegistered($nodeData)) {
                        // No, then throw an exception
-                       throw new NodeDataMissingException(array($this, $nodeData), self::EXCEPTION_NODE_NOT_REGISTERED);
+                       throw new NodeDataMissingException([$this, $nodeData], self::EXCEPTION_NODE_NOT_REGISTERED);
                }
 
                // Get a search instance
index 8d2d6f905468228a490ecb03f1b9b5122169199c..b619549c54b7f81198ee8d18d41a4e9a91f49402 100644 (file)
@@ -145,7 +145,7 @@ class PeerStateLookupDatabaseFrontend extends BaseHubDatabaseFrontend implements
                // Make sure only new peers can be registered with package data
                if (!$this->isSenderNewPeer($packageInstance)) {
                        // Throw an exception because this should normally not happen
-                       throw new PeerAlreadyRegisteredException(array($this, $packageInstance), self::EXCEPTION_PEER_ALREADY_REGISTERED);
+                       throw new PeerAlreadyRegisteredException([$this, $packageInstance], self::EXCEPTION_PEER_ALREADY_REGISTERED);
                }
 
                // Generate a dataset instance
index 96067f75a2f92bcfbad57817ff5d5ca7161574aa..0dcbc4ac5e45b86031c29e76490be8a37f98ce9a 100644 (file)
@@ -295,7 +295,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
                         * Do not register non-existent nodes here. This is maybe fatal,
                         * caused by "stolen" session id and/or not matching address.
                         */
-                       throw new NodeSessionIdVerficationException(array($this, $messageInstance), DistributableNode::EXCEPTION_NODE_SESSION_ID_NOT_VERIFYING);
+                       throw new NodeSessionIdVerficationException([$this, $messageInstance], DistributableNode::EXCEPTION_NODE_SESSION_ID_NOT_VERIFYING);
                }
 
                // Save last exception
index eb0e3e790c080bccd5773e815bb55050adb1379c..47bb93df5626686068528540be06575f90c1983b 100644 (file)
@@ -10,6 +10,9 @@ use Org\Mxchange\CoreFramework\Factory\BaseFactory;
 use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
 use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
 
+// Import SPL stuff
+use \InvalidArgumentException;
+
 /**
  * A factory class for communicator states
  *
index 6d7125fbeffad0d290872b4c4ed50c7efb0a12c0..89369496c524b5f3f305f7fe0761f20dd138eb8f 100644 (file)
@@ -67,7 +67,7 @@ class NodeStateFactory extends BaseFactory {
                }
 
                // Get a class from that configuration entry
-               $stateInstance = ObjectFactory::createObjectByConfiguredName('node_' . $stateName . '_state_class', array($nodeInstance));
+               $stateInstance = ObjectFactory::createObjectByConfiguredName('node_' . $stateName . '_state_class', [$nodeInstance]);
 
                // Debug message
                self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-STATE-FACTORY: Node state has changed from ' . $nodeInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.');
index e14a6b18e9461ea628374a5cb0777320fd0cfaa5..19655093be08db6a089f8e41f8e3888db6137f9c 100644 (file)
@@ -239,7 +239,7 @@ class ChunkHandler extends BaseHubHandler implements HandleableChunks, Registera
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CHUNK-HANDLER: chunkSplits()=%d - CALLED!', count($chunkSplits)));
                if (isset($this->finalPackageChunks[$chunkSplits[self::CHUNK_SPLITS_INDEX_SERIAL]])) {
                        // Then throw an exception
-                       throw new ChunkAlreadyAssembledException(array($this, $chunkSplits), HandleableChunks::EXCEPTION_CHUNK_ALREADY_ASSEMBLED);
+                       throw new ChunkAlreadyAssembledException([$this, $chunkSplits], HandleableChunks::EXCEPTION_CHUNK_ALREADY_ASSEMBLED);
                }
 
                // Add the chunk data (index 2) to the final array and use the serial number as index
@@ -506,9 +506,9 @@ class ChunkHandler extends BaseHubHandler implements HandleableChunks, Registera
                try {
                        // Validate final chunk
                        $this->isFinalChunkValid($chunks);
-               } catch (AssertionException $e) {
+               } catch (AssertionException $exception) {
                        // Last chunk is not valid
-                       throw new FinalChunkVerificationException(array($this, $chunks, $e), self::EXCEPTION_FINAL_CHUNK_VERIFICATION);
+                       throw new FinalChunkVerificationException([$this, $chunks, $exception], self::EXCEPTION_FINAL_CHUNK_VERIFICATION);
                }
 
                // Do we have some pending chunks (no final)?
index c965cc8b7b13697d7b729a0e706be2224063eac9..9e49ef7e7cd67d1188eb608f60d96a4b0cdc4fff 100644 (file)
@@ -116,7 +116,7 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl
                         * This node is not accepting announcements, then someone wants to
                         * announce his node to a non-bootstrap and non-master node.
                         */
-                       throw new AnnouncementNotAcceptedException(array($this, $nodeInstance, $messageInstance), HandleableMessage::EXCEPTION_ANNOUNCEMENT_NOT_ACCEPTED);
+                       throw new AnnouncementNotAcceptedException([$this, $nodeInstance, $messageInstance], HandleableMessage::EXCEPTION_ANNOUNCEMENT_NOT_ACCEPTED);
                }
 
                // Register the announcing node with this node
index 7b743f6f8d24f717bc84dc14185260691e591c1f..bb0366d29748129237112fa5b5a5e57069454bcc 100644 (file)
@@ -115,7 +115,7 @@ class NodeMessageAnnouncementAnswerHandler extends BaseMessageHandler implements
                         * This node has never announced itself, so it doesn't expect
                         * announcement answer messages.
                         */
-                       throw new NoAnnouncementAttemptedException(array($this, $nodeInstance, $messageInstance), HandleableMessage::EXCEPTION_ANNOUNCEMENT_NOT_ATTEMPTED);
+                       throw new NoAnnouncementAttemptedException([$this, $nodeInstance, $messageInstance], HandleableMessage::EXCEPTION_ANNOUNCEMENT_NOT_ATTEMPTED);
                }
 
                // Register the announcing node with this node
index 5aaf1212d26dc992f3d5bfe6804515788b16f58c..92e7dd13f5729ba9e7cd536c1fa0718367ff89ac 100644 (file)
@@ -114,7 +114,7 @@ class NodeMessageDhtBootstrapAnswerHandler extends BaseMessageHandler implements
                         * This DHT has never bootstrapped, so it doesn't expect
                         * announcement answer messages.
                         */
-                       throw new NoDhtBootstrapAttemptedException(array($this, $dhtInstance, $messageInstance), HandleableMessage::EXCEPTION_DHT_BOOTSTRAP_NOT_ATTEMPTED);
+                       throw new NoDhtBootstrapAttemptedException([$this, $dhtInstance, $messageInstance], HandleableMessage::EXCEPTION_DHT_BOOTSTRAP_NOT_ATTEMPTED);
                }
 
                // Unfinished
index 3045dd95308debadabb7a60065d1adc486a9b715..d69bc30fa5b4e98a904a95c02c0760261fdd5887 100644 (file)
@@ -104,7 +104,7 @@ class NodeMessageRequestNodeListAnswerHandler extends BaseMessageHandler impleme
                         * This node has never announced itself, so it doesn't expect
                         * request-node-list answer messages.
                         */
-                       throw new NoRequestNodeListAttemptedException(array($this, $nodeInstance, $messageInstance), HandleableMessage::EXCEPTION_ANNOUNCEMENT_NOT_ATTEMPTED);
+                       throw new NoRequestNodeListAttemptedException([$this, $nodeInstance, $messageInstance], HandleableMessage::EXCEPTION_ANNOUNCEMENT_NOT_ATTEMPTED);
                }
 
                // Register the announcing node with this node
index 83cf9eab6a934024b40363e7d3dd598c8da0f47e..07b64c83b3dd794bb072a7ce74fdc2fe641dcf29 100644 (file)
@@ -108,7 +108,7 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl
                        /*
                         * This node is not accepting DHT bootstrap requests.
                         */
-                       throw new DhtBootstrapNotAcceptedException(array($this, $messageInstance), HandleableMessage::EXCEPTION_DHT_BOOTSTRAP_NOT_ACCEPTED);
+                       throw new DhtBootstrapNotAcceptedException([$this, $messageInstance], HandleableMessage::EXCEPTION_DHT_BOOTSTRAP_NOT_ACCEPTED);
                }
 
                // Register the DHT bootstrap requesting node with this node
index b3bbb86940bc842b2154bc9bb703e7e0eaa2e94d..63ac689ecd213f929a9154935277b4709371f503 100644 (file)
@@ -96,7 +96,7 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha
                         * This node is not accepting node list requests. Throw an
                         * exception to abort any further processing.
                         */
-                       throw new RequestNotAcceptedException(array($this, $nodeInstance, $messageInstance), HandleableMessage::EXCEPTION_REQUEST_NOT_ACCEPTED);
+                       throw new RequestNotAcceptedException([$this, $nodeInstance, $messageInstance], HandleableMessage::EXCEPTION_REQUEST_NOT_ACCEPTED);
                }
 
                // Register the announcing node with this node
index 474083834e61886123b884140eeb2906dcdbe78c..5e565a2d287e2d92fe600670325168654f489f29 100644 (file)
@@ -1417,7 +1417,7 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
                // Is the package status 'failed'?
                if ($packageInstance->getPackageStatus() != self::PACKAGE_STATUS_FAILED) {
                        // Not failed!
-                       throw new UnexpectedPackageStatusException(array($this, $packageInstance, self::PACKAGE_STATUS_FAILED), self::EXCEPTION_UNEXPECTED_PACKAGE_STATUS);
+                       throw new UnexpectedPackageStatusException([$this, $packageInstance, self::PACKAGE_STATUS_FAILED], self::EXCEPTION_UNEXPECTED_PACKAGE_STATUS);
                }
 
                // Remove this entry
@@ -1590,7 +1590,7 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
                        throw new InvalidArgumentException('messageInstance does not contain senderId');
                } elseif (empty($messageInstance->getSenderPrivateKeyHash())) {
                        // This needs fixing
-                       throw new InvalidPrivateKeyHashException(array($this, $senderData, 'empty hash in decodedData'), DiscoverableUniversalNodeLocator::EXCEPTION_INVALID_PRIVATE_KEY_HASH);
+                       throw new InvalidPrivateKeyHashException([$this, $senderData, 'empty hash in decodedData'], DiscoverableUniversalNodeLocator::EXCEPTION_INVALID_PRIVATE_KEY_HASH);
                } elseif (!$this->isMessageContentHashValid($messageInstance)) {
                        // Is not valid, so throw an exception here
                        ApplicationEntryPoint::exitApplication(__METHOD__ . ':INVALID HASH! UNDER CONSTRUCTION!' . PHP_EOL);
@@ -1643,7 +1643,7 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
                        throw new InvalidArgumentException('packageInstance does not contain senderId');
                } elseif (empty($packageInstance->getSenderPrivateKeyHash())) {
                        // This needs fixing
-                       throw new InvalidPrivateKeyHashException(array($this, $senderData, 'empty hash in decodedData'), DiscoverableUniversalNodeLocator::EXCEPTION_INVALID_PRIVATE_KEY_HASH);
+                       throw new InvalidPrivateKeyHashException([$this, $senderData, 'empty hash in decodedData'], DiscoverableUniversalNodeLocator::EXCEPTION_INVALID_PRIVATE_KEY_HASH);
                } elseif (!$this->isPackageContentHashValid($packageInstance)) {
                        // Is not valid, so throw an exception here
                        ApplicationEntryPoint::exitApplication(__METHOD__ . ':INVALID HASH! UNDER CONSTRUCTION!' . PHP_EOL);
index 1d4f859b7db081fb400c7d88e6fda4748d00f35a..6e0cc2a0fc79aa7f96ef7886c57607540506a03a 100644 (file)
@@ -177,7 +177,7 @@ class UniversalNodeLocator extends BaseHubSystem implements LocateableNode, Regi
                // Is the element there?
                if (!isset($unlData[NodeInformationDatabaseFrontend::DB_COLUMN_EXTERNAL_UNL])) {
                        // Is not there
-                       throw new MissingArrayElementsException(array($this, 'unlData', array(NodeInformationDatabaseFrontend::DB_COLUMN_EXTERNAL_UNL)), self::EXCEPTION_ARRAY_ELEMENTS_MISSING);
+                       throw new MissingArrayElementsException([$this, 'unlData', [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), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
@@ -200,7 +200,7 @@ class UniversalNodeLocator extends BaseHubSystem implements LocateableNode, Regi
                // Is the element there?
                if (!isset($unlData[NodeInformationDatabaseFrontend::DB_COLUMN_INTERNAL_UNL])) {
                        // Is not there
-                       throw new MissingArrayElementsException(array($this, 'unlData', array(NodeInformationDatabaseFrontend::DB_COLUMN_INTERNAL_UNL)), self::EXCEPTION_ARRAY_ELEMENTS_MISSING);
+                       throw new MissingArrayElementsException([$this, 'unlData', [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), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
index 122d92ac3aab0d4fd13faa526e1829e9c1b03e84..d90c330a82408c5b21dc5306d8f72cd83f5667d6 100644 (file)
@@ -340,7 +340,7 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable,
                // Abort if the call-back method is not there
                if (!method_exists($callable[0], $callable[1])) {
                        // Throw an exception
-                       throw new UnsupportedPackageCodeHandlerException(array($callable, $packageInstance), self::EXCEPTION_UNSUPPORTED_PACKAGE_CODE_HANDLER);
+                       throw new UnsupportedPackageCodeHandlerException([$callable, $packageInstance], self::EXCEPTION_UNSUPPORTED_PACKAGE_CODE_HANDLER);
                }
 
                // Call it back
index be0128585467653b2f13c25290e5b4ceef1653e9..27361313a0b47a48763e5511e5238ab8f810ce58 100644 (file)
@@ -119,7 +119,7 @@ class DefaultPeerPool extends BasePool implements PoolablePeer {
                // Is the connection type valid?
                if (!$socketInstance->isValidConnectionType($connectionType)) {
                        // Is not a valid connection type!
-                       throw new InvalidConnectionTypeException(array($this, $connectionType), StorableSocket::EXCEPTION_INVALID_CONNECTION_TYPE);
+                       throw new InvalidConnectionTypeException([$this, $connectionType], StorableSocket::EXCEPTION_INVALID_CONNECTION_TYPE);
                }
 
                // Default is this peer's IP
@@ -217,7 +217,7 @@ class DefaultPeerPool extends BasePool implements PoolablePeer {
                                // Is the connection type valid?
                                if (!$socketArray[Poolable::SOCKET_ARRAY_INSTANCE]->isValidConnectionType($connectionType)) {
                                        // Is not a valid connection type!
-                                       throw new InvalidConnectionTypeException(array($this, $connectionType), self::EXCEPTION_INVALID_CONNECTION_TYPE);
+                                       throw new InvalidConnectionTypeException([$this, $connectionType], self::EXCEPTION_INVALID_CONNECTION_TYPE);
                                }
 
                                // Add the socket
@@ -270,7 +270,7 @@ class DefaultPeerPool extends BasePool implements PoolablePeer {
                                throw new LogicException(sprintf('socketArray[%s] is not set.', Poolable::SOCKET_ARRAY_CONN_TYPE));
                        } elseif ((!empty($connectionType)) && (!$socketArray[Poolable::SOCKET_ARRAY_INSTANCE]->isValidConnectionType($connectionType))) {
                                // Is not a valid connection type!
-                               throw new InvalidConnectionTypeException(array($this, $connectionType), self::EXCEPTION_INVALID_CONNECTION_TYPE);
+                               throw new InvalidConnectionTypeException([$this, $connectionType], self::EXCEPTION_INVALID_CONNECTION_TYPE);
                        } elseif ((!empty($connectionType)) && ($socketArray[Poolable::SOCKET_ARRAY_CONN_TYPE] !== $connectionType)) {
                                // Skip unwanted sockets
                                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('DEFAULT-PEER-POOL: Skipping unwanted socket %s of type %s/%s ...', $socketArray[Poolable::SOCKET_ARRAY_INSTANCE]->getPrintableName(), $socketArray[Poolable::SOCKET_ARRAY_CONN_TYPE], $connectionType));
index 4abd82bcba21e55a9d78de604697886f53d2dcd7..f663e9608e21b4ac32f07ccbd11dbba635845bcc 100644 (file)
@@ -8,6 +8,9 @@ use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
 use Org\Mxchange\CoreFramework\Resolver\Command\BaseCommandResolver;
 use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver;
 
+// Import SPL stuff
+use \InvalidArgumentException;
+
 /**
  * A command resolver for local (non-hubbed) web commands
  *
@@ -50,20 +53,20 @@ class HubConsoleCommandResolver extends BaseCommandResolver implements CommandRe
         * @param       $commandName                            The default command we shall execute
         * @param       $applicationInstance            An instance of a manageable application helper class
         * @return      $resolverInstance                       The prepared command resolver instance
-        * @throws      EmptyVariableException          Thrown if default command is not set
+        * @throws      InvalidArgumentException        Thrown if default command is not set
         * @throws      InvalidCommandException         Thrown if default command is invalid
         */
-       public static final function createHubConsoleCommandResolver ($commandName, ManageableApplication $applicationInstance) {
+       public static final function createHubConsoleCommandResolver (string $commandName, ManageableApplication $applicationInstance) {
                // Create the new instance
                $resolverInstance = new HubConsoleCommandResolver();
 
                // Is the variable $commandName set and the command is valid?
                if (empty($commandName)) {
                        // Then thrown an exception here
-                       throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+                       throw new InvalidArgumentException('Parameter "commandName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif ($resolverInstance->isCommandValid('Org\Shipsimu\Hub\Command', $commandName) === FALSE) {
                        // Invalid command found
-                       throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND);
+                       throw new InvalidCommandException([$resolverInstance, $commandName], self::EXCEPTION_INVALID_COMMAND);
                }
 
                // Set namespace and application instance
index 320c78c3a3415b6258b3eaa55996e38f5b66e1e8..e801392a59c50f67bc49d38d370825b0e05c31f5 100644 (file)
@@ -8,6 +8,9 @@ use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
 use Org\Mxchange\CoreFramework\Resolver\Command\BaseCommandResolver;
 use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver;
 
+// Import SPL stuff
+use \InvalidArgumentException;
+
 /**
  * A command resolver for HTML commands
  *
@@ -50,20 +53,20 @@ class HubHtmlCommandResolver extends BaseCommandResolver implements CommandResol
         * @param       $commandName                            The default command we shall execute
         * @param       $applicationInstance            An instance of a manageable application helper class
         * @return      $resolverInstance                       The prepared command resolver instance
-        * @throws      EmptyVariableException          Thrown if default command is not set
+        * @throws      InvalidArgumentException                Thrown if default command is not set
         * @throws      InvalidCommandException         Thrown if default command is invalid
         */
-       public static final function createHubHtmlCommandResolver ($commandName, ManageableApplication $applicationInstance) {
+       public static final function createHubHtmlCommandResolver (string $commandName, ManageableApplication $applicationInstance) {
                // Create the new instance
                $resolverInstance = new HubHtmlCommandResolver();
 
                // Is the variable $commandName set and the command is valid?
                if (empty($commandName)) {
                        // Then thrown an exception here
-                       throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+                       throw new InvalidArgumentException('Parameter "commandName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif ($resolverInstance->isCommandValid('Org\Shipsimu\Hub\Command', $commandName) === FALSE) {
                        // Invalid command found
-                       throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND);
+                       throw new InvalidCommandException([$resolverInstance, $commandName], self::EXCEPTION_INVALID_COMMAND);
                }
 
                // Set namespace and application instance
index e596642d025572cb7c5fd59d504c47a76b7517cb..38d9e5cca8d43e1a5c2876add6830dd9db1e645d 100644 (file)
@@ -48,7 +48,7 @@ class HubConsoleControllerResolver extends BaseControllerResolver implements Con
         *
         * @param       $controllerName                         The controller we shall resolve
         * @return      $resolverInstance                       The prepared controller resolver instance
-        * @throws      EmptyVariableException          Thrown if default command is not set
+        * @throws      InvalidArgumentException        Thrown if default command is not set
         * @throws      InvalidControllerException      Thrown if default controller is invalid
         */
        public static final function createHubConsoleControllerResolver ($controllerName) {
@@ -58,10 +58,10 @@ class HubConsoleControllerResolver extends BaseControllerResolver implements Con
                // Is the variable $controllerName set and the command is valid?
                if (empty($controllerName)) {
                        // Then thrown an exception here
-                       throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+                       throw new InvalidArgumentException('Parameter "controllerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif ($resolverInstance->isControllerValid('Org\Shipsimu\Hub\Controller', $controllerName) === false)  {
                        // Invalid command found
-                       throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
+                       throw new InvalidControllerException([$resolverInstance, $controllerName], self::EXCEPTION_INVALID_CONTROLLER);
                }
 
                // Set namespace and command name
@@ -94,7 +94,7 @@ class HubConsoleControllerResolver extends BaseControllerResolver implements Con
                // And validate it
                if ((!is_object($controllerInstance)) || (!$controllerInstance instanceof Controller)) {
                        // This command has an invalid instance!
-                       throw new InvalidControllerInstanceException(array($this, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
+                       throw new InvalidControllerInstanceException([$this, $controllerName], self::EXCEPTION_INVALID_CONTROLLER);
                }
 
                // Set last controller
index 15c286ca8259e1f79d9384f3948758f3e860abf2..ace2249805ed71a04a7d72a6bf664c2cba8f6f99 100644 (file)
@@ -48,7 +48,7 @@ class HubHtmlControllerResolver extends BaseControllerResolver implements Contro
         *
         * @param       $controllerName                         The controller we shall resolve
         * @return      $resolverInstance                       The prepared controller resolver instance
-        * @throws      EmptyVariableException          Thrown if default command is not set
+        * @throws      InvalidArgumentException        Thrown if default command is not set
         * @throws      InvalidControllerException      Thrown if default controller is invalid
         */
        public static final function createHubHtmlControllerResolver ($controllerName) {
@@ -58,10 +58,10 @@ class HubHtmlControllerResolver extends BaseControllerResolver implements Contro
                // Is the variable $controllerName set and the command is valid?
                if (empty($controllerName)) {
                        // Then thrown an exception here
-                       throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+                       throw new InvalidArgumentException('Parameter "controllerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif ($resolverInstance->isControllerValid('Org\Shipsimu\Hub\Controller', $controllerName) === false)  {
                        // Invalid command found
-                       throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
+                       throw new InvalidControllerException([$resolverInstance, $controllerName], self::EXCEPTION_INVALID_CONTROLLER);
                }
 
                // Set namespace and command name
@@ -94,7 +94,7 @@ class HubHtmlControllerResolver extends BaseControllerResolver implements Contro
                // And validate it
                if ((!is_object($controllerInstance)) || (!$controllerInstance instanceof Controller)) {
                        // This command has an invalid instance!
-                       throw new InvalidControllerInstanceException(array($this, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
+                       throw new InvalidControllerInstanceException([$this, $controllerName], self::EXCEPTION_INVALID_CONTROLLER);
                }
 
                // Set last controller
index fd7e000de42eaa2752ddfb791a4bc106367dca70..72138f23d9a8b03c52302ecdc9c8a59b07ec52a2 100644 (file)
@@ -57,7 +57,7 @@ abstract class BaseStateResolver extends BaseResolver {
         * @param       $statePrefix    Last validated statePrefix
         * @return      void
         */
-       protected final function setStatePrefix ($statePrefix) {
+       protected final function setStatePrefix (string $statePrefix): void {
                $this->statePrefix = $statePrefix;
        }
 
@@ -67,7 +67,7 @@ abstract class BaseStateResolver extends BaseResolver {
         * @param       $statePrefix    Last validated statePrefix
         * @return      void
         */
-       protected final function getStatePrefix () {
+       protected final function getStatePrefix (): string {
                return $this->statePrefix;
        }
 
@@ -77,7 +77,7 @@ abstract class BaseStateResolver extends BaseResolver {
         * @param       $stateName              Last validated state name
         * @return      void
         */
-       protected final function setStateName ($stateName) {
+       protected final function setStateName (string $stateName): void {
                $this->stateName = $stateName;
        }
 
@@ -86,7 +86,7 @@ abstract class BaseStateResolver extends BaseResolver {
         *
         * @return      $stateName      Last validated state name
         */
-       public final function getStateName () {
+       public final function getStateName (): string {
                return $this->stateName;
        }
 
@@ -96,10 +96,17 @@ abstract class BaseStateResolver extends BaseResolver {
         *
         * @param       $stateName                      A state name we shall look for
         * @return      $stateInstance          A loaded state instance
+        * @throws      InvalidArgumentException        Thrown if given state is not set
         * @throws      UnresolveableStateException             Thrown if even the requested
         *                                                                                      state class is missing (bad!)
         */
-       protected function loadState ($stateName) {
+       protected function loadState (string $stateName) {
+               // Is a state set?
+               if (empty($stateName)) {
+                       // Then thrown an exception here
+                       throw new InvalidArgumentException('Parameter "stateName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
+               }
+
                // Init state instance
                $stateInstance = NULL;
 
@@ -112,7 +119,7 @@ abstract class BaseStateResolver extends BaseResolver {
                // Is this class loaded?
                if (!class_exists($this->getClassName())) {
                        // Throw an exception here
-                       throw new UnresolveableStateException(array($this, $stateName), self::EXCEPTION_INVALID_STATE);
+                       throw new UnresolveableStateException([$this, $stateName], self::EXCEPTION_INVALID_STATE);
                }
 
                // Initialize the state
@@ -130,19 +137,19 @@ abstract class BaseStateResolver extends BaseResolver {
         *
         * @param       $stateName                              The default state we shall execute
         * @return      $isValid                                Whether the given state is valid
-        * @throws      EmptyVariableException  Thrown if given state is not set
+        * @throws      InvalidArgumentException        Thrown if given state is not set
         * @throws      DefaultStateException   Thrown if default state was not found
         */
-       public function isStateValid ($stateName) {
-               // By default nothing shall be valid
-               $isValid = FALSE;
-
+       public function isStateValid (string $stateName): bool {
                // Is a state set?
                if (empty($stateName)) {
                        // Then thrown an exception here
-                       throw new EmptyVariableException(array($this, 'stateName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+                       throw new InvalidArgumentException('Parameter "stateName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                }
 
+               // By default nothing shall be valid
+               $isValid = FALSE;
+
                // Create class name
                $className = $this->statePrefix . StringUtils::convertToClassName($stateName) . 'State';
 
index 6e60a2a326e8c4949e82f006ac1e974c05271328..954b3be6e8bca8339f5047c5f07f6c2bcddfd325 100644 (file)
@@ -161,7 +161,7 @@ class PackageTags extends BaseTag implements Tagable {
                        //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d] entry=%s', __METHOD__, __LINE__, print_r($entry, TRUE)));
                        if ((!is_array($entry)) || (count($entry) == 0) || (!isset($entry[XmlObjectRegistryTemplateEngine::OBJECT_TYPE_DATA_PROTOCOL])) || (!isset($entry[XmlObjectRegistryTemplateEngine::OBJECT_TYPE_DATA_RECIPIENT_TYPE]))) {
                                // Invalid entry found
-                               throw new InvalidTagException(array($this, $tag), self::EXCEPTION_INVALID_TAG);
+                               throw new InvalidTagException([$this, $tag], self::EXCEPTION_INVALID_TAG);
                        }
 
                        // Now save the last discovered protocol/recipient type
index 00bffa972c29d198c975fe48f298900b6628e350..3f471466cc629667aa7031980b2fff8723f38bbd 100644 (file)
@@ -33,8 +33,8 @@ interface StateResolver extends Resolver {
         *
         * @param       $stateName      The default state we shall execute
         * @return      $isValid        Whether the given state is valid
-        * @throws      EmptyVariableException  Thrown if given state is not set
+        * @throws      InvalidArgumentException        Thrown if given state is not set
         */
-       function isStateValid (string $stateName);
+       function isStateValid (string $stateName): void;
 
 }
diff --git a/core b/core
index ff2afec772b7b5959d6225d70d2bd352d0f8c684..7c9c09a0065013ed20f8361e87ad6ceda7896cb9 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit ff2afec772b7b5959d6225d70d2bd352d0f8c684
+Subproject commit 7c9c09a0065013ed20f8361e87ad6ceda7896cb9