From c3a48fafb65aeb2b01ccc30d204695214778fe2c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 7 Nov 2020 15:50:08 +0100 Subject: [PATCH] Continued: - convertToClassName() is now in StringUtils - updated core framework MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- application/hub/class_ApplicationHelper.php | 3 ++- .../classes/container/socket/class_SocketContainer.php | 3 ++- .../classes/factories/node/class_NodeObjectFactory.php | 5 +++-- .../classes/package/assembler/class_PackageAssembler.php | 3 ++- .../classes/resolver/state/class_BaseStateResolver.php | 5 +++-- .../hub/classes/template/class_BaseXmlTemplateEngine.php | 9 +++++---- core | 2 +- 7 files changed, 18 insertions(+), 12 deletions(-) diff --git a/application/hub/class_ApplicationHelper.php b/application/hub/class_ApplicationHelper.php index 3da31cd29..0a430c832 100644 --- a/application/hub/class_ApplicationHelper.php +++ b/application/hub/class_ApplicationHelper.php @@ -13,6 +13,7 @@ use Org\Mxchange\CoreFramework\Loader\ClassLoader; use Org\Mxchange\CoreFramework\Manager\ManageableApplication; use Org\Mxchange\CoreFramework\Registry\Registerable; use Org\Mxchange\CoreFramework\Template\CompileableTemplate; +use Org\Mxchange\CoreFramework\Utils\String\StringUtils; /** * A class holding general data about the application and some methods for @@ -150,7 +151,7 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication // Get a controller resolver $resolverClass = sprintf( 'Org\Shipsimu\Hub\Resolver\Controller\%s', - self::convertToClassName(sprintf( + StringUtils::convertToClassName(sprintf( '%s_%s_controller_resolver', $this->getAppShortName(), FrameworkBootstrap::getRequestTypeFromSystem() diff --git a/application/hub/classes/container/socket/class_SocketContainer.php b/application/hub/classes/container/socket/class_SocketContainer.php index db96217db..f3f403b03 100644 --- a/application/hub/classes/container/socket/class_SocketContainer.php +++ b/application/hub/classes/container/socket/class_SocketContainer.php @@ -25,6 +25,7 @@ use Org\Mxchange\CoreFramework\Socket\SocketBindingException; use Org\Mxchange\CoreFramework\Socket\SocketConnectionException; use Org\Mxchange\CoreFramework\Socket\SocketOperationException; use Org\Mxchange\CoreFramework\Socket\UnsupportedSocketErrorHandlerException; +use Org\Mxchange\CoreFramework\Utils\String\StringUtils; use Org\Mxchange\CoreFramework\Visitor\Visitable; use Org\Mxchange\CoreFramework\Visitor\Visitor; @@ -1057,7 +1058,7 @@ class SocketContainer extends BaseHubContainer implements StorableSocket, Visita protected function getSocketErrorHandlerFromCode (int $errorCode) { // Create a name from translated error code //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: errorCode=%d - CALLED!', strtoupper($this->getSocketProtocol()), $errorCode)); - $handlerName = 'handleSocketError' . self::convertToClassName($this->translateSocketErrorCodeToName($errorCode)); + $handlerName = 'handleSocketError' . StringUtils::convertToClassName($this->translateSocketErrorCodeToName($errorCode)); // Is the call-back method there? if (!method_exists($this, $handlerName)) { diff --git a/application/hub/classes/factories/node/class_NodeObjectFactory.php b/application/hub/classes/factories/node/class_NodeObjectFactory.php index 0118b1f99..1d526775b 100644 --- a/application/hub/classes/factories/node/class_NodeObjectFactory.php +++ b/application/hub/classes/factories/node/class_NodeObjectFactory.php @@ -8,6 +8,7 @@ use Org\Mxchange\CoreFramework\Factory\ObjectFactory; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Response\Responseable; +use Org\Mxchange\CoreFramework\Utils\String\StringUtils; /** * A factory class for nodes @@ -80,8 +81,8 @@ class NodeObjectFactory extends ObjectFactory { // Now convert the node-mode in a class name $className = sprintf( 'Org\Shipsimu\Hub\Node\%s\Hub%sNode', - $factoryInstance->convertToClassName($nodeMode), - $factoryInstance->convertToClassName($nodeMode) + StringUtils::convertToClassName($nodeMode), + StringUtils::convertToClassName($nodeMode) ); // Get the node instance diff --git a/application/hub/classes/package/assembler/class_PackageAssembler.php b/application/hub/classes/package/assembler/class_PackageAssembler.php index a1e3f4bd3..256b72d6d 100644 --- a/application/hub/classes/package/assembler/class_PackageAssembler.php +++ b/application/hub/classes/package/assembler/class_PackageAssembler.php @@ -17,6 +17,7 @@ use Org\Shipsimu\Hub\Network\Receive\Receivable; // Import framework stuff use Org\Mxchange\CoreFramework\Factory\ObjectFactory; use Org\Mxchange\CoreFramework\Registry\Registerable; +use Org\Mxchange\CoreFramework\Utils\String\StringUtils; use Org\Mxchange\CoreFramework\Visitor\Visitable; use Org\Mxchange\CoreFramework\Visitor\Visitor; @@ -335,7 +336,7 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, public function chunkPackageInstance (DeliverablePackage $packageInstance) { // Construct call-back name from package error code /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-ASSEMBLER: packageInstance=%s - CALLED!', $packageInstance->__toString())); - $this->callbacks[$packageInstance->getErrorCode()] = 'handlePackageBy' . self::convertToClassName($packageInstance->getErrorCode()); + $this->callbacks[$packageInstance->getErrorCode()] = 'handlePackageBy' . StringUtils::convertToClassName($packageInstance->getErrorCode()); // Init callable array $callable = [ diff --git a/application/hub/classes/resolver/state/class_BaseStateResolver.php b/application/hub/classes/resolver/state/class_BaseStateResolver.php index a3d1cae90..e1a4dc1b6 100644 --- a/application/hub/classes/resolver/state/class_BaseStateResolver.php +++ b/application/hub/classes/resolver/state/class_BaseStateResolver.php @@ -5,6 +5,7 @@ namespace Org\Shipsimu\Hub\Resolver\State; // Import framework stuff use Org\Mxchange\CoreFramework\Factory\ObjectFactory; use Org\Mxchange\CoreFramework\Resolver\BaseResolver; +use Org\Mxchange\CoreFramework\Utils\String\StringUtils; /** * A generic state resolver class @@ -103,7 +104,7 @@ abstract class BaseStateResolver extends BaseResolver { $stateInstance = NULL; // Create state class name - $className = $this->getStatePrefix() . '' . self::convertToClassName($stateName) . 'State'; + $className = $this->getStatePrefix() . '' . StringUtils::convertToClassName($stateName) . 'State'; // ... and set it $this->setClassName($className); @@ -143,7 +144,7 @@ abstract class BaseStateResolver extends BaseResolver { } // END - if // Create class name - $className = $this->statePrefix . self::convertToClassName($stateName) . 'State'; + $className = $this->statePrefix . StringUtils::convertToClassName($stateName) . 'State'; // Now, let us create the full name of the state class $this->setClassName($className); diff --git a/application/hub/classes/template/class_BaseXmlTemplateEngine.php b/application/hub/classes/template/class_BaseXmlTemplateEngine.php index 06c7715a3..3cd57446b 100644 --- a/application/hub/classes/template/class_BaseXmlTemplateEngine.php +++ b/application/hub/classes/template/class_BaseXmlTemplateEngine.php @@ -8,6 +8,7 @@ use Org\Mxchange\CoreFramework\Factory\ObjectFactory; use Org\Mxchange\CoreFramework\Factory\Template\XmlTemplateEngineFactory; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Template\Engine\BaseTemplateEngine; +use Org\Mxchange\CoreFramework\Utils\String\StringUtils; // Import SPL stuff use \InvalidArgumentException; @@ -292,7 +293,7 @@ abstract class BaseXmlTemplateEngine extends BaseTemplateEngine { */ public final function startElement ($resource, $element, array $attributes) { // Initial method name which will never be called... - $methodName = 'init' . self::convertToClassName($this->xmlTemplateType); + $methodName = 'init' . StringUtils::convertToClassName($this->xmlTemplateType); // Make the element name lower-case $element = strtolower($element); @@ -301,13 +302,13 @@ abstract class BaseXmlTemplateEngine extends BaseTemplateEngine { //* DEBUG: */ echo "START: >".$element."<
\n"; if (in_array($element, $this->getMainNodes())) { // Okay, main node found! - $methodName = 'start' . self::convertToClassName($element); + $methodName = 'start' . StringUtils::convertToClassName($element); // Set it $this->setCurrMainNode($element); } elseif (in_array($element, $this->getSubNodes())) { // Sub node found - $methodName = 'start' . self::convertToClassName($element); + $methodName = 'start' . StringUtils::convertToClassName($element); } else { // Invalid node name found throw new InvalidXmlNodeException(array($this, $element, $attributes), XmlParser::EXCEPTION_XML_NODE_UNKNOWN); @@ -337,7 +338,7 @@ abstract class BaseXmlTemplateEngine extends BaseTemplateEngine { } // END - if // Construct method name - $methodName = 'finish' . self::convertToClassName($nodeName); + $methodName = 'finish' . StringUtils::convertToClassName($nodeName); // Call the corresponding method //* DEBUG: */ echo "call: ".$methodName."
\n"; diff --git a/core b/core index 9128348f9..513812814 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 9128348f96854b318a9bf8884b1ee035f3f94e6c +Subproject commit 513812814a5a17022d414727e5a4c6d0823fe5f6 -- 2.39.5