From 5fb6010a5e2fb821a65717babe9128234e409c93 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 22 Nov 2020 17:38:22 +0100 Subject: [PATCH] Continued: - added missing $templateInstance and getter/setter - converted old array() to "new" [] style - added missing config entries - 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 | 19 ++++++----- .../class_HubConsoleAptProxyCommand.php | 4 +-- .../console/class_HubConsoleChatCommand.php | 4 +-- .../class_HubConsoleCrawlerCommand.php | 4 +-- .../class_HubConsoleCruncherCommand.php | 4 +-- .../console/class_HubConsoleMainCommand.php | 4 +-- .../console/class_HubConsoleMinerCommand.php | 4 +-- .../socket/class_SocketContainer.php | 8 ++--- .../classes/dht/node/class_NodeDhtFacade.php | 10 +++--- .../info/class_ConnectionInfoFactory.php | 2 +- .../classes/filter/class_BaseHubFilter.php | 2 +- .../handler/chunks/class_ChunkHandler.php | 8 ++--- .../handler/data/class_BaseDataHandler.php | 8 ++--- .../helper/class_BaseHubSystemHelper.php | 29 +++++++++++++++- .../connection/class_BaseConnectionHelper.php | 2 +- .../locator/class_UniversalNodeLocator.php | 4 +-- .../hub/classes/miner/class_BaseHubMiner.php | 2 +- .../assembler/class_PackageAssembler.php | 2 +- .../package/deliverable/class_PackageData.php | 2 +- .../fragmenter/class_PackageFragmenter.php | 18 +++++----- .../pools/peer/class_DefaultPeerPool.php | 4 +-- .../work_units/class_BaseUnitProducer.php | 27 +++++++++++++++ .../class_HubConsoleControllerResolver.php | 4 +-- .../html/class_HubHtmlControllerResolver.php | 4 +-- .../class_CrawlerUploadedListUrlSource.php | 2 +- .../miner/booting/class_MinerBootingState.php | 2 +- .../hub/classes/tags/class_BaseTag.php | 27 ++++++++++++++- .../template/class_BaseXmlTemplateEngine.php | 33 ++++++++++++++++--- .../hub/classes/tools/hub/class_HubTools.php | 2 +- application/hub/config.php | 6 ++++ core | 2 +- 31 files changed, 175 insertions(+), 78 deletions(-) diff --git a/application/hub/class_ApplicationHelper.php b/application/hub/class_ApplicationHelper.php index 0a430c832..ea51d451e 100644 --- a/application/hub/class_ApplicationHelper.php +++ b/application/hub/class_ApplicationHelper.php @@ -148,16 +148,17 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication $this->setLanguageInstance($languageInstance); } // END - if - // Get a controller resolver - $resolverClass = sprintf( - 'Org\Shipsimu\Hub\Resolver\Controller\%s', - StringUtils::convertToClassName(sprintf( - '%s_%s_controller_resolver', - $this->getAppShortName(), - FrameworkBootstrap::getRequestTypeFromSystem() - )) + // Configuration entry key + $configEntry = sprintf( + '%s_%s_controller_resolver_class', + $this->getAppShortName(), + FrameworkBootstrap::getRequestTypeFromSystem() ); - $resolverInstance = ObjectFactory::createObjectByName($resolverClass, array($commandName, $this)); + + // Get a controller resolver instance + $resolverInstance = ObjectFactory::createObjectByConfiguredName($configEntry, [ + $commandName, + ]); // Get a controller instance as well $this->setControllerInstance($resolverInstance->resolveController()); diff --git a/application/hub/classes/commands/console/class_HubConsoleAptProxyCommand.php b/application/hub/classes/commands/console/class_HubConsoleAptProxyCommand.php index b3e5a18d8..bc40a9273 100644 --- a/application/hub/classes/commands/console/class_HubConsoleAptProxyCommand.php +++ b/application/hub/classes/commands/console/class_HubConsoleAptProxyCommand.php @@ -138,7 +138,5 @@ class HubConsoleAptProxyCommand extends BaseCommand implements Commandable { // This is the last generic shutdown filter $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('apt_proxy_shutdown_filter_class')); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/commands/console/class_HubConsoleChatCommand.php b/application/hub/classes/commands/console/class_HubConsoleChatCommand.php index fb95de6d0..044b3abca 100644 --- a/application/hub/classes/commands/console/class_HubConsoleChatCommand.php +++ b/application/hub/classes/commands/console/class_HubConsoleChatCommand.php @@ -138,7 +138,5 @@ class HubConsoleChatCommand extends BaseCommand implements Commandable { // This is the last generic shutdown filter $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('chat_shutdown_filter_class')); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/commands/console/class_HubConsoleCrawlerCommand.php b/application/hub/classes/commands/console/class_HubConsoleCrawlerCommand.php index 149dd3016..2eb9830b6 100644 --- a/application/hub/classes/commands/console/class_HubConsoleCrawlerCommand.php +++ b/application/hub/classes/commands/console/class_HubConsoleCrawlerCommand.php @@ -138,7 +138,5 @@ class HubConsoleCrawlerCommand extends BaseCommand implements Commandable { // This is the last generic shutdown filter $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('crawler_shutdown_filter_class')); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/commands/console/class_HubConsoleCruncherCommand.php b/application/hub/classes/commands/console/class_HubConsoleCruncherCommand.php index 7cacaaae1..0f1623909 100644 --- a/application/hub/classes/commands/console/class_HubConsoleCruncherCommand.php +++ b/application/hub/classes/commands/console/class_HubConsoleCruncherCommand.php @@ -139,7 +139,5 @@ class HubConsoleCruncherCommand extends BaseCommand implements Commandable { // This is the last generic shutdown filter $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('cruncher_shutdown_filter_class')); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/commands/console/class_HubConsoleMainCommand.php b/application/hub/classes/commands/console/class_HubConsoleMainCommand.php index 6923cb7ea..092eeaba7 100644 --- a/application/hub/classes/commands/console/class_HubConsoleMainCommand.php +++ b/application/hub/classes/commands/console/class_HubConsoleMainCommand.php @@ -153,7 +153,5 @@ class HubConsoleMainCommand extends BaseCommand implements Commandable { // This is the last generic shutdown filter $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('node_shutdown_node_filter_class')); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/commands/console/class_HubConsoleMinerCommand.php b/application/hub/classes/commands/console/class_HubConsoleMinerCommand.php index 5fdce95c8..ba86d25d2 100644 --- a/application/hub/classes/commands/console/class_HubConsoleMinerCommand.php +++ b/application/hub/classes/commands/console/class_HubConsoleMinerCommand.php @@ -139,7 +139,5 @@ class HubConsoleMinerCommand extends BaseCommand implements Commandable { // This is the last generic shutdown filter $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('miner_shutdown_filter_class')); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/container/socket/class_SocketContainer.php b/application/hub/classes/container/socket/class_SocketContainer.php index f3f403b03..283258f01 100644 --- a/application/hub/classes/container/socket/class_SocketContainer.php +++ b/application/hub/classes/container/socket/class_SocketContainer.php @@ -68,7 +68,7 @@ class SocketContainer extends BaseHubContainer implements StorableSocket, Visita /** * An array with all valid connection types */ - private $connectionTypes = array(); + private $connectionTypes = []; /** * Timeout in usec for socket_select() @@ -737,9 +737,9 @@ class SocketContainer extends BaseHubContainer implements StorableSocket, Visita // Init all arrays, at least readers /* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s', strtoupper($this->getSocketProtocol()), $this->getSocketResource())); - $readers = array($this->getSocketResource()); - $writers = array(); - $excepts = array(); + $readers = [$this->getSocketResource()]; + $writers = []; + $excepts = []; // Check if we have some peers left /* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: Calling socket_select(%d,%d,%d,0%d) ...', strtoupper($this->getSocketProtocol()), count($readers), count($writers), count($excepts), $this->socketSelectTimeout)); diff --git a/application/hub/classes/dht/node/class_NodeDhtFacade.php b/application/hub/classes/dht/node/class_NodeDhtFacade.php index 9ccb7920e..97a635f7e 100644 --- a/application/hub/classes/dht/node/class_NodeDhtFacade.php +++ b/application/hub/classes/dht/node/class_NodeDhtFacade.php @@ -174,7 +174,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable { } // Default is empty data array - $nodeData = array(); + $nodeData = []; /* * Call the wrapper to do the job and get back a result instance. There @@ -210,7 +210,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable { // Default is empty data array /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: locatorInstance=%s - CALLED!', $locatorInstance->__toString())); //* DEBUG-DIE: */ die(sprintf('[%s:%d]: locatorInstance=%s', __METHOD__, __LINE__, print_r($locatorInstance, TRUE))); - $nodeData = array(); + $nodeData = []; // Query database $resultInstance = $this->getWrapperInstance()->findNodeLocalByLocatorInstance($locatorInstance); @@ -333,7 +333,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable { assert($resultInstance->valid()); // Init array - $nodeList = array(); + $nodeList = []; // Get node list while ($resultInstance->next()) { @@ -407,7 +407,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable { } // END - if // Init array - $recipients = array(); + $recipients = []; // Search for all recipients while ($resultInstance->next()) { @@ -447,7 +447,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable { assert($resultInstance->valid()); // Init array - $recipients = array(); + $recipients = []; // "Walk" through all entries while ($resultInstance->next()) { diff --git a/application/hub/classes/factories/info/class_ConnectionInfoFactory.php b/application/hub/classes/factories/info/class_ConnectionInfoFactory.php index 719459c2e..0c6d01001 100644 --- a/application/hub/classes/factories/info/class_ConnectionInfoFactory.php +++ b/application/hub/classes/factories/info/class_ConnectionInfoFactory.php @@ -38,7 +38,7 @@ class ConnectionInfoFactory extends ObjectFactory { /** * Array with all valid types */ - private static $validTypes = array(); + private static $validTypes = []; /** * Protected constructor diff --git a/application/hub/classes/filter/class_BaseHubFilter.php b/application/hub/classes/filter/class_BaseHubFilter.php index cd740b93f..a0252091c 100644 --- a/application/hub/classes/filter/class_BaseHubFilter.php +++ b/application/hub/classes/filter/class_BaseHubFilter.php @@ -37,7 +37,7 @@ abstract class BaseHubFilter extends BaseFilter { /** * Array with all data XML nodes (which hold the actual data) and their values */ - protected $dataXmlNodes = array(); + protected $dataXmlNodes = []; /** * Protected constructor diff --git a/application/hub/classes/handler/chunks/class_ChunkHandler.php b/application/hub/classes/handler/chunks/class_ChunkHandler.php index f27d4ed55..05eed6ee3 100644 --- a/application/hub/classes/handler/chunks/class_ChunkHandler.php +++ b/application/hub/classes/handler/chunks/class_ChunkHandler.php @@ -58,12 +58,12 @@ class ChunkHandler extends BaseHubHandler implements HandleableChunks, Registera /** * The final array for assembling the original package back together */ - private $finalPackageChunks = array(); + private $finalPackageChunks = []; /** * Array of chunk hashes */ - private $chunkHashes = array(); + private $chunkHashes = []; /** * Raw EOP chunk data in an array: @@ -71,7 +71,7 @@ class ChunkHandler extends BaseHubHandler implements HandleableChunks, Registera * 0 = Final hash, * 1 = Hash of last chunk */ - private $eopChunk = array(); + private $eopChunk = []; /** * An instance of raw package data @@ -161,7 +161,7 @@ class ChunkHandler extends BaseHubHandler implements HandleableChunks, Registera ); // ... chunkHashes: - $this->chunkHashes = array(); + $this->chunkHashes = []; // ... eopChunk: $this->eopChunk = array( diff --git a/application/hub/classes/handler/data/class_BaseDataHandler.php b/application/hub/classes/handler/data/class_BaseDataHandler.php index a1fa1c001..c452b7425 100644 --- a/application/hub/classes/handler/data/class_BaseDataHandler.php +++ b/application/hub/classes/handler/data/class_BaseDataHandler.php @@ -44,23 +44,23 @@ abstract class BaseDataHandler extends BaseHubHandler implements HubInterface { /** * Array with search criteria elements */ - protected $searchData = array(); + protected $searchData = []; /** * Array with all data XML nodes (which hold the actual data) and their values */ - protected $messageDataElements = array(); + protected $messageDataElements = []; /** * Array for translating message data elements (other node's data mostly) * into configuration elements. */ - protected $messageToConfig = array(); + protected $messageToConfig = []; /** * Array for copying configuration entries */ - protected $configCopy = array(); + protected $configCopy = []; /** * Protected constructor diff --git a/application/hub/classes/helper/class_BaseHubSystemHelper.php b/application/hub/classes/helper/class_BaseHubSystemHelper.php index a4d96251f..959863a61 100644 --- a/application/hub/classes/helper/class_BaseHubSystemHelper.php +++ b/application/hub/classes/helper/class_BaseHubSystemHelper.php @@ -5,6 +5,9 @@ namespace Org\Shipsimu\Hub\Helper; // Import application-specific stuff use Org\Shipsimu\Hub\Generic\BaseHubSystem; +// Import framework stuff +use Org\Mxchange\CoreFramework\Template\CompileableTemplate; + /** * A general hub helper class. This class does not extend BaseHelper. * @@ -41,7 +44,12 @@ class BaseHubSystemHelper extends BaseHubSystem implements HubHelper { /** * Package tags */ - private $packageTags = array(); + private $packageTags = []; + + /** + * Template engine instance + */ + private $templateInstance = NULL; /** * Protected constructor @@ -109,6 +117,25 @@ class BaseHubSystemHelper extends BaseHubSystem implements HubHelper { $this->packageTags = $packageTags; } + /** + * Setter for template engine instances + * + * @param $templateInstance An instance of a template engine class + * @return void + */ + protected final function setTemplateInstance (CompileableTemplate $templateInstance) { + $this->templateInstance = $templateInstance; + } + + /** + * Getter for template engine instances + * + * @return $templateInstance An instance of a template engine class + */ + public final function getTemplateInstance () { + return $this->templateInstance; + } + /** * Tries to determine the used protocol for this package (this helper is helping to send out) * diff --git a/application/hub/classes/helper/connection/class_BaseConnectionHelper.php b/application/hub/classes/helper/connection/class_BaseConnectionHelper.php index 03f258e39..6dcb5c86c 100644 --- a/application/hub/classes/helper/connection/class_BaseConnectionHelper.php +++ b/application/hub/classes/helper/connection/class_BaseConnectionHelper.php @@ -67,7 +67,7 @@ abstract class BaseConnectionHelper extends BaseHubSystemHelper implements Visit /** * Currently queued chunks */ - private $queuedChunks = array(); + private $queuedChunks = []; /** * Current final hash diff --git a/application/hub/classes/locator/class_UniversalNodeLocator.php b/application/hub/classes/locator/class_UniversalNodeLocator.php index 8d89393b5..bb0d31b4f 100644 --- a/application/hub/classes/locator/class_UniversalNodeLocator.php +++ b/application/hub/classes/locator/class_UniversalNodeLocator.php @@ -41,7 +41,7 @@ class UniversalNodeLocator extends BaseHubSystem implements LocateableNode, Regi /** * UNL data array */ - private $unlData = array(); + private $unlData = []; /** * Protected constructor @@ -132,7 +132,7 @@ class UniversalNodeLocator extends BaseHubSystem implements LocateableNode, Regi */ private function initUniversalNodeLocator (array $unlData = array()) { // Init UNL array - $this->unlData = array(); + $this->unlData = []; // Copy all found entries foreach (array( diff --git a/application/hub/classes/miner/class_BaseHubMiner.php b/application/hub/classes/miner/class_BaseHubMiner.php index c0a72a836..0fc26141c 100644 --- a/application/hub/classes/miner/class_BaseHubMiner.php +++ b/application/hub/classes/miner/class_BaseHubMiner.php @@ -55,7 +55,7 @@ abstract class BaseHubMiner extends BaseHubSystem implements Updateable { /** * An array for initialized producers */ - private $producersInitialized = array(); + private $producersInitialized = []; /** * Stacker name for incoming queue diff --git a/application/hub/classes/package/assembler/class_PackageAssembler.php b/application/hub/classes/package/assembler/class_PackageAssembler.php index 34cda4532..9ccbac0ee 100644 --- a/application/hub/classes/package/assembler/class_PackageAssembler.php +++ b/application/hub/classes/package/assembler/class_PackageAssembler.php @@ -67,7 +67,7 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, /** * Private call-back methods */ - private $callbacks = array(); + private $callbacks = []; /** * A network package handler instance diff --git a/application/hub/classes/package/deliverable/class_PackageData.php b/application/hub/classes/package/deliverable/class_PackageData.php index 4d0f7c5a1..72e2dce22 100644 --- a/application/hub/classes/package/deliverable/class_PackageData.php +++ b/application/hub/classes/package/deliverable/class_PackageData.php @@ -457,7 +457,7 @@ class PackageData extends BaseHubSystem implements DeliverablePackage, Registera $properties = $reflectionInstance->getProperties(ReflectionProperty::IS_PRIVATE); // Init array - $packageData = array(); + $packageData = []; // Loop through all //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-DATA: properties()=%d', count($properties))); diff --git a/application/hub/classes/package/fragmenter/class_PackageFragmenter.php b/application/hub/classes/package/fragmenter/class_PackageFragmenter.php index 87ca2eb7f..8f3696bf1 100644 --- a/application/hub/classes/package/fragmenter/class_PackageFragmenter.php +++ b/application/hub/classes/package/fragmenter/class_PackageFragmenter.php @@ -55,27 +55,27 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera /** * Array for chunks */ - private $chunks = array(); + private $chunks = []; /** * Array for chunk hashes */ - private $chunkHashes = array(); + private $chunkHashes = []; /** * Array for chunk pointers */ - private $chunkPointers = array(); + private $chunkPointers = []; /** * Array for processed packages */ - private $processedPackages = array(); + private $processedPackages = []; /** * Serial numbers (array key is final hash) */ - private $serialNumber = array(); + private $serialNumber = []; /** * Maximum possible serial number, "cache" for speeding up things @@ -135,8 +135,10 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: CALLED!'); $fragmenterInstance = new PackageFragmenter(); - // Get a crypto instance and set it here + // Get a crypto instance $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class'); + + // Set it here $fragmenterInstance->setCryptoInstance($cryptoInstance); // Return the prepared instance @@ -430,8 +432,8 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera // Is the array there? if (!isset($this->chunks[$finalHash])) { // Then initialize it - $this->chunks[$finalHash] = array(); - $this->chunkHashes[$finalHash] = array(); + $this->chunks[$finalHash] = []; + $this->chunkHashes[$finalHash] = []; } // END - if // Add both diff --git a/application/hub/classes/pools/peer/class_DefaultPeerPool.php b/application/hub/classes/pools/peer/class_DefaultPeerPool.php index 7f57e148f..4b135d1b0 100644 --- a/application/hub/classes/pools/peer/class_DefaultPeerPool.php +++ b/application/hub/classes/pools/peer/class_DefaultPeerPool.php @@ -175,7 +175,7 @@ class DefaultPeerPool extends BasePool implements PoolablePeer { $socketArrays = $this->getArrayFromList('pool'); // Init socket array - $sockets = array(); + $sockets = []; // "Walk" through all socket arrays foreach ($socketArrays as $socketArray) { @@ -207,7 +207,7 @@ class DefaultPeerPool extends BasePool implements PoolablePeer { $socketArrays = $this->getArrayFromList('pool'); // Init socket array - $sockets = array(); + $sockets = []; // "Walk" through all socket arrays foreach ($socketArrays as $socketArray) { diff --git a/application/hub/classes/producer/cruncher/work_units/class_BaseUnitProducer.php b/application/hub/classes/producer/cruncher/work_units/class_BaseUnitProducer.php index 542f4e4f2..bc801b509 100644 --- a/application/hub/classes/producer/cruncher/work_units/class_BaseUnitProducer.php +++ b/application/hub/classes/producer/cruncher/work_units/class_BaseUnitProducer.php @@ -5,6 +5,9 @@ namespace Org\Shipsimu\Hub\Producer\Cruncher\Unit; // Import application-specific stuff use Org\Shipsimu\Hub\Producer\Cruncher\BaseCruncherProducer; +// Import framework stuff +use Org\Mxchange\CoreFramework\Template\CompileableTemplate; + /** * A general UnitProducer class * @@ -41,6 +44,11 @@ abstract class BaseUnitProducer extends BaseCruncherProducer { const UNIT_TYPE_TEST_UNIT = 'test_unit'; const UNIT_TYPE_TEST_WORK = 'work_unit'; + /** + * Template engine instance + */ + private $templateInstance = NULL; + /** * Protected constructor * @@ -52,4 +60,23 @@ abstract class BaseUnitProducer extends BaseCruncherProducer { parent::__construct($className); } + /** + * Setter for template engine instances + * + * @param $templateInstance An instance of a template engine class + * @return void + */ + protected final function setTemplateInstance (CompileableTemplate $templateInstance) { + $this->templateInstance = $templateInstance; + } + + /** + * Getter for template engine instances + * + * @return $templateInstance An instance of a template engine class + */ + protected final function getTemplateInstance () { + return $this->templateInstance; + } + } diff --git a/application/hub/classes/resolver/controller/console/class_HubConsoleControllerResolver.php b/application/hub/classes/resolver/controller/console/class_HubConsoleControllerResolver.php index 6c80fbcba..b9750b317 100644 --- a/application/hub/classes/resolver/controller/console/class_HubConsoleControllerResolver.php +++ b/application/hub/classes/resolver/controller/console/class_HubConsoleControllerResolver.php @@ -4,7 +4,6 @@ namespace Org\Shipsimu\Hub\Resolver\Controller; // Import framework stuff use Org\Mxchange\CoreFramework\Controller\Controller; -use Org\Mxchange\CoreFramework\Manager\ManageableApplication; use Org\Mxchange\CoreFramework\Resolver\Controller\BaseControllerResolver; use Org\Mxchange\CoreFramework\Resolver\Controller\ControllerResolver; @@ -48,12 +47,11 @@ class HubConsoleControllerResolver extends BaseControllerResolver implements Con * Creates an instance of a resolver class with a given command * * @param $controllerName The controller we shall resolve - * @param $applicationInstance An instance of a manageable application helper class * @return $resolverInstance The prepared controller resolver instance * @throws EmptyVariableException Thrown if default command is not set * @throws InvalidControllerException Thrown if default controller is invalid */ - public static final function createHubConsoleControllerResolver ($controllerName, ManageableApplication $applicationInstance) { + public static final function createHubConsoleControllerResolver ($controllerName) { // Create the new instance $resolverInstance = new HubConsoleControllerResolver(); diff --git a/application/hub/classes/resolver/controller/html/class_HubHtmlControllerResolver.php b/application/hub/classes/resolver/controller/html/class_HubHtmlControllerResolver.php index f89514ab9..71ad86c5e 100644 --- a/application/hub/classes/resolver/controller/html/class_HubHtmlControllerResolver.php +++ b/application/hub/classes/resolver/controller/html/class_HubHtmlControllerResolver.php @@ -4,7 +4,6 @@ namespace Org\Shipsimu\Hub\Resolver\Controller; // Import framework stuff use Org\Mxchange\CoreFramework\Controller\Controller; -use Org\Mxchange\CoreFramework\Manager\ManageableApplication; use Org\Mxchange\CoreFramework\Resolver\Controller\BaseControllerResolver; use Org\Mxchange\CoreFramework\Resolver\Controller\ControllerResolver; @@ -48,12 +47,11 @@ class HubHtmlControllerResolver extends BaseControllerResolver implements Contro * Creates an instance of a resolver class with a given command * * @param $controllerName The controller we shall resolve - * @param $applicationInstance An instance of a manageable application helper class * @return $resolverInstance The prepared controller resolver instance * @throws EmptyVariableException Thrown if default command is not set * @throws InvalidControllerException Thrown if default controller is invalid */ - public static final function createHubHtmlControllerResolver ($controllerName, ManageableApplication $applicationInstance) { + public static final function createHubHtmlControllerResolver ($controllerName) { // Create the new instance $resolverInstance = new HubHtmlControllerResolver(); diff --git a/application/hub/classes/source/urls/class_CrawlerUploadedListUrlSource.php b/application/hub/classes/source/urls/class_CrawlerUploadedListUrlSource.php index 2b56d7ab2..ba2d141bf 100644 --- a/application/hub/classes/source/urls/class_CrawlerUploadedListUrlSource.php +++ b/application/hub/classes/source/urls/class_CrawlerUploadedListUrlSource.php @@ -76,7 +76,7 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R /** * "Imported" CSV files */ - private $csvFileImported = array(); + private $csvFileImported = []; /** * "Cached" separator for columns diff --git a/application/hub/classes/states/miner/booting/class_MinerBootingState.php b/application/hub/classes/states/miner/booting/class_MinerBootingState.php index 615d96050..7b3522aa5 100644 --- a/application/hub/classes/states/miner/booting/class_MinerBootingState.php +++ b/application/hub/classes/states/miner/booting/class_MinerBootingState.php @@ -32,7 +32,7 @@ class MinerBootingState extends BaseMinerState implements Stateable { /** * Array of booted producers */ - private $bootedProducer = array(); + private $bootedProducer = []; /** * Protected constructor diff --git a/application/hub/classes/tags/class_BaseTag.php b/application/hub/classes/tags/class_BaseTag.php index 0f21e5c91..82c02929c 100644 --- a/application/hub/classes/tags/class_BaseTag.php +++ b/application/hub/classes/tags/class_BaseTag.php @@ -7,6 +7,7 @@ use Org\Shipsimu\Hub\Generic\BaseHubSystem; // Import framework stuff use Org\Mxchange\CoreFramework\Registry\Registerable; +use Org\Mxchange\CoreFramework\Template\CompileableTemplate; /** * A general Tags class @@ -34,7 +35,12 @@ abstract class BaseTag extends BaseHubSystem implements Registerable { /** * An array with all tags */ - private $tags = array(); + private $tags = []; + + /** + * Template engine instance + */ + private $templateInstance = NULL; /** * Protected constructor @@ -66,4 +72,23 @@ abstract class BaseTag extends BaseHubSystem implements Registerable { return $this->tags; } + /** + * Setter for template engine instances + * + * @param $templateInstance An instance of a template engine class + * @return void + */ + protected final function setTemplateInstance (CompileableTemplate $templateInstance) { + $this->templateInstance = $templateInstance; + } + + /** + * Getter for template engine instances + * + * @return $templateInstance An instance of a template engine class + */ + protected final function getTemplateInstance () { + return $this->templateInstance; + } + } diff --git a/application/hub/classes/template/class_BaseXmlTemplateEngine.php b/application/hub/classes/template/class_BaseXmlTemplateEngine.php index 3cd57446b..c9e34b3b4 100644 --- a/application/hub/classes/template/class_BaseXmlTemplateEngine.php +++ b/application/hub/classes/template/class_BaseXmlTemplateEngine.php @@ -7,6 +7,7 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Factory\ObjectFactory; use Org\Mxchange\CoreFramework\Factory\Template\XmlTemplateEngineFactory; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; +use Org\Mxchange\CoreFramework\Template\CompileableTemplate; use Org\Mxchange\CoreFramework\Template\Engine\BaseTemplateEngine; use Org\Mxchange\CoreFramework\Utils\String\StringUtils; @@ -40,17 +41,17 @@ abstract class BaseXmlTemplateEngine extends BaseTemplateEngine { /** * Main nodes in the XML tree */ - private $mainNodes = array(); + private $mainNodes = []; /** * Sub nodes in the XML tree */ - private $subNodes = array(); + private $subNodes = []; /** * Current main node */ - private $curr = array(); + private $curr = []; /** * XML template type @@ -70,7 +71,12 @@ abstract class BaseXmlTemplateEngine extends BaseTemplateEngine { /** * Content from dependency */ - protected $dependencyContent = array(); + protected $dependencyContent = []; + + /** + * Template engine instance + */ + private $templateInstance = NULL; /** * Protected constructor @@ -227,6 +233,25 @@ abstract class BaseXmlTemplateEngine extends BaseTemplateEngine { return $this->subNodes; } + /** + * Setter for template engine instances + * + * @param $templateInstance An instance of a template engine class + * @return void + */ + protected final function setTemplateInstance (CompileableTemplate $templateInstance) { + $this->templateInstance = $templateInstance; + } + + /** + * Getter for template engine instances + * + * @return $templateInstance An instance of a template engine class + */ + protected final function getTemplateInstance () { + return $this->templateInstance; + } + /** * Read XML variables by calling readVariable() with 'general' as * variable stack. diff --git a/application/hub/classes/tools/hub/class_HubTools.php b/application/hub/classes/tools/hub/class_HubTools.php index 0e0f71110..733de785c 100644 --- a/application/hub/classes/tools/hub/class_HubTools.php +++ b/application/hub/classes/tools/hub/class_HubTools.php @@ -47,7 +47,7 @@ class HubTools extends BaseHubSystem { /** * Cache for session ids */ - private $sessionIdCache = array(); + private $sessionIdCache = []; /** * Length for session id (should be 32+salt_length diff --git a/application/hub/config.php b/application/hub/config.php index f9ed99a70..7559cde75 100644 --- a/application/hub/config.php +++ b/application/hub/config.php @@ -162,6 +162,12 @@ $cfg->setConfigEntry('default_console_command', 'main'); // CFG: DEFAULT-HUB-CONSOLE-COMMAND $cfg->setConfigEntry('default_hub_console_command', 'main'); +// CFG: HUB-CONSOLE-CONTROLLER_RESOLVER-CLASS +$cfg->setConfigEntry('hub_console_controller_resolver_class', 'Org\Shipsimu\Hub\Resolver\Controller\HubConsoleControllerResolver'); + +// CFG: HUB-HTML-CONTROLLER_RESOLVER-CLASS +$cfg->setConfigEntry('hub_html_controller_resolver_class', 'Org\Shipsimu\Hub\Resolver\Controller\HubHtmlControllerResolver'); + // CFG: HUB-CONSOLE-CMD-MAIN-RESOLVER-CLASS $cfg->setConfigEntry('hub_console_cmd_main_resolver_class', 'Org\Shipsimu\Hub\Resolver\Command\HubConsoleCommandResolver'); diff --git a/core b/core index 690d7f053..df3701b72 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 690d7f053ed4420a1aff4387be75d8ae75155bdf +Subproject commit df3701b7230349ee2bc711caba98809ac943363c -- 2.39.5