* @return void
* @throws XmlCompactorDecoratorException If an XML error was found
*/
- public function parseXmlContent (string $content) {
+ public function parseXmlContent (string $content): void {
// Remove all comments for better compacting
$content = $this->getParserInstance()->getTemplateInstance()->compactContent($content);
use Org\Mxchange\CoreFramework\Template\Xml\CompileableXmlTemplate;
use Org\Mxchange\CoreFramework\Traits\Template\CompileableTemplateTrait;
+// Import SPL stuff
+use \XMLParser;
+
/**
* A decorator for XML template engines which rewrites the XML for compacting
* it.
* @return void
* @throws XmlParserException If an XML error was found
*/
- public function renderXmlContent (string $content = '') {
+ public function renderXmlContent (string $content = ''): void {
// Call the inner class' method
$this->getTemplateInstance()->renderXmlContent($content);
}
* @param $languageSupport New language support setting
* @return void
*/
- public function enableLanguageSupport (bool $languageSupport = true) {
+ public function enableLanguageSupport (bool $languageSupport = true): void {
// Call the inner class' method
$this->getTemplateInstance()->enableLanguageSupport($languageSupport);
}
*
* @return $languageSupport Whether language support is enabled or disabled
*/
- public function isLanguageSupportEnabled () {
+ public function isLanguageSupportEnabled (): bool {
// Call the inner class' method
return $this->getTemplateInstance()->isLanguageSupportEnabled();
}
* @param $xmlCompacting New XML compacting setting
* @return void
*/
- public function enableXmlCompacting (bool $xmlCompacting = true) {
+ public function enableXmlCompacting (bool $xmlCompacting = true): void {
// Call the inner class' method
$this->getTemplateInstance()->enableXmlCompacting($xmlCompacting);
}
*
* @return $xmlCompacting Whether XML compacting is enabled or disabled
*/
- public function isXmlCompactingEnabled () {
+ public function isXmlCompactingEnabled (): bool {
// Call the inner class' method
return $this->getTemplateInstance()->isXmlCompactingEnabled();
}
* @return void
* @throws InvalidXmlNodeException If an unknown/invalid XML node name was found
*/
- public function startElement ($resource, string $element, array $attributes) {
+ public function startElement (XMLParser $resource, string $element, array $attributes): void {
// Call the inner class' method
$this->getTemplateInstance()->startElement($resource, $element, $attributes);
}
* @return void
* @throws XmlNodeMismatchException If current main node mismatches the closing one
*/
- public function finishElement ($resource, string $nodeName) {
+ public function finishElement (XMLParser $resource, string $nodeName): void {
// Call the inner class' method
$this->getTemplateInstance()->finishElement($resource, $nodeName);
}
* @return void
* @todo Find something useful with this!
*/
- public function characterHandler ($resource, string $characters) {
+ public function characterHandler (XMLParser $resource, string $characters): void {
// Call the inner class' method but trim the characters before
$this->getTemplateInstance()->characterHandler($resource, trim($characters));
}
* @param $uncompactedContent The uncompacted content
* @return $compactedContent The compacted content
*/
- public function compactContent (string $uncompactedContent) {
+ public function compactContent (string $uncompactedContent): string {
// Compact it ...
$compactedContent = $this->getTemplateInstance()->compactContent($uncompactedContent);
* @param $variables An array with variables to be assigned
* @return void
*/
- public function assignMultipleVariables (array $variables) {
+ public function assignMultipleVariables (array $variables): void {
// Call the inner class' method but trim the characters before
$this->getTemplateInstance()->assignMultipleVariables($variables);
}
* @return void
* @throws XmlParserException If an XML error was found
*/
- public function parseXmlContent (string $content) {
+ public function parseXmlContent (string $content): void {
// Convert all to UTF8
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('XML-PARSER: content()=%d - CALLED!', strlen($content)));
if (empty($content)) {
* @param $languageSupport New language support setting
* @return void
*/
- public final function enableLanguageSupport (bool $languageSupport = true) {
+ public final function enableLanguageSupport (bool $languageSupport = true): void {
$this->languageSupport = $languageSupport;
}
*
* @return $languageSupport Whether language support is enabled or disabled
*/
- public final function isLanguageSupportEnabled () {
+ public final function isLanguageSupportEnabled (): bool {
return $this->languageSupport;
}
* @param $uncompactedContent The uncompacted content
* @return $compactedContent The compacted content
*/
- public function compactContent (string $uncompactedContent) {
+ public function compactContent (string $uncompactedContent): string {
// Validate parameter
if (empty($uncompactedContent)) {
// Throw an exception
// Import SPL stuff
use \SplFileInfo;
use \UnexpectedValueException;
+use \XMLParser;
/**
* The own template engine for loading caching and sending out images
* @return void
* @throws InvalidXmlNodeException If an unknown/invalid XML node name was found
*/
- public function startElement ($resource, string $element, array $attributes) {
+ public function startElement (XMLParser $resource, string $element, array $attributes): void {
// Initial method name which will never be called...
$methodName = 'initImage';
* @return void
* @throws XmlNodeMismatchException If current main node mismatches the closing one
*/
- public function finishElement ($resource, string $nodeName) {
+ public function finishElement (XMLParser $resource, string $nodeName): void {
// Does this match with current main node?
//* DEBUG: */ echo "END: >".$nodeName."<<br />\n";
if (($nodeName != $this->getCurrMainNode()) && (in_array($nodeName, $this->getMainNodes()))) {
* @return void
* @todo Find something usefull with this!
*/
- public function characterHandler ($resource, string $characters) {
+ public function characterHandler (XMLParser $resource, string $characters): void {
// Trim all spaces away
$characters = trim($characters);
// Import SPL stuff
use \UnexpectedValueException;
+use \XMLParser;
/**
* The own template engine for loading caching and sending out images
* @return void
* @throws InvalidXmlNodeException If an unknown/invalid XML node name was found
*/
- public function startElement ($resource, string $element, array $attributes) {
+ public function startElement (XMLParser $resource, string $element, array $attributes): void {
// Initial method name which will never be called...
$methodName = 'initEmail';
* @return void
* @throws XmlNodeMismatchException If current main node mismatches the closing one
*/
- public function finishElement ($resource, string $nodeName) {
+ public function finishElement (XMLParser $resource, string $nodeName): void {
// Does this match with current main node?
//* DEBUG: */ echo "END: >".$nodeName."<<br />\n";
if (($nodeName != $this->getCurrMainNode()) && (in_array($nodeName, $this->getMainNodes()))) {
* @param $characters Characters to handle
* @return void
*/
- public function characterHandler ($resource, string $characters) {
+ public function characterHandler (XMLParser $resource, string $characters): void {
// Trim all spaces away
$characters = trim($characters);
// Import SPL stuff
use \SplFileInfo;
use \UnexpectedValueException;
+use \XMLParser;
/**
* A Menu template engine class
* @return void
* @throws InvalidXmlNodeException If an unknown/invalid XML node name was found
*/
- public function startElement ($resource, string $element, array $attributes) {
+ public function startElement (XMLParser $resource, string $element, array $attributes): void {
// Initial method name which will never be called...
$methodName = 'initMenu';
* @return void
* @throws XmlNodeMismatchException If current main node mismatches the closing one
*/
- public function finishElement ($resource, string $nodeName) {
+ public function finishElement (XMLParser $resource, string $nodeName): void {
// Does this match with current main node?
//* DEBUG: */ echo "END: >".$nodeName."<<br />\n";
if (($nodeName != $this->getCurrMainNode()) && (in_array($nodeName, $this->getMainNodes()))) {
// Did not match!
- throw new XmlNodeMismatchException (array($this, $nodeName, $this->getCurrMainNode()), Parseable::EXCEPTION_XML_NODE_MISMATCH);
+ throw new XmlNodeMismatchException ([$this, $nodeName, $this->getCurrMainNode()], Parseable::EXCEPTION_XML_NODE_MISMATCH);
}
// Construct method name
* @return void
* @todo Find something useful with this!
*/
- public function characterHandler ($resource, string $characters) {
+ public function characterHandler (XMLParser $resource, string $characters): void {
// Trim all spaces away
$characters = trim($characters);
* @param $templateDependency A template to load to satisfy dependencies
* @return void
*/
- private function handleTemplateDependency (string $node, string $templateDependency) {
+ private function handleTemplateDependency (string $node, string $templateDependency): void {
// Is the template dependency set?
if ((!empty($templateDependency)) && (!isset($this->dependencyContent[$node]))) {
// Get a temporay menu template instance
* @return void
* @todo Add cache creation here
*/
- private function initMenu (string $templateDependency = '') {
+ private function initMenu (string $templateDependency = ''): void {
// Get web template engine
$this->setTemplateInstance(ObjectFactory::createObjectByConfiguredName('html_template_class', array(ApplicationHelper::getSelfInstance())));
*
* @return $fileInstance Full-qualified file name of the menu cache
*/
- public function getMenuCacheFile () {
+ public function getMenuCacheFile (): SplFileInfo {
// Get the application instance from registry
$applicationInstance = ApplicationHelper::getSelfInstance();
// Import SPL stuff
use \InvalidArgumentException;
+use \XMLParser;
/**
* A generic XML template engine class
* @return void
* @throws InvalidArgumentException If a parameter has an invalid value
*/
- protected function handleTemplateDependency (string $node, string $templateDependency) {
+ protected function handleTemplateDependency (string $node, string $templateDependency): void {
// Check parameter
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-XML-TEMPLATE-ENGINE: node=%s,templateDependency=%s - CALLED!', $node, $templateDependency));
if (empty($node)) {
* @throws InvalidArgumentException If a parameter has an invalid value
* @throws InvalidXmlNodeException If an unknown/invalid XML node name was found
*/
- public final function startElement ($resource, string $element, array $attributes) {
+ public final function startElement ($resource, string $element, array $attributes): void {
// Check parameters
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-XML-TEMPLATE-ENGINE: resource[%s]=%s,element=%s,attributes()=%d - CALLED!', gettype($resource), $resource, $element, count($attributes)));
- if (!is_resource($resource)) {
- // Throw IAE
- throw new InvalidArgumentException(sprintf('Parameter resource has unexpected type %s', gettype($resource)), FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
- } elseif (empty($element)) {
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-XML-TEMPLATE-ENGINE: resource[%s]=%s,element=%s,attributes()=%d - CALLED!', gettype($resource), get_class($resource), $element, count($attributes)));
+ if (empty($element)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "element" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
}
* @return void
* @throws XmlNodeMismatchException If current main node mismatches the closing one
*/
- public final function finishElement ($resource, string $nodeName) {
+ public final function finishElement (XMLParser $resource, string $nodeName): void {
// Check parameters
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-XML-TEMPLATE-ENGINE: resource[%s]=%s,nodeName=%s - CALLED!', gettype($resource), $resource, $nodeName));
- if (!is_resource($resource)) {
- // Throw IAE
- throw new InvalidArgumentException(sprintf('Parameter resource has unexpected type %s', gettype($resource)), FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
- } elseif (empty($nodeName)) {
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-XML-TEMPLATE-ENGINE: resource[%s]=%s,nodeName=%s - CALLED!', gettype($resource), get_class($resource), $nodeName));
+ if (empty($nodeName)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "nodeName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
}
* @return void
* @throws InvalidArgumentException If a parameter has an invalid value
*/
- public function renderXmlContent (string $content = '') {
+ public function renderXmlContent (string $content = ''): void {
// Is the content set?
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-XML-TEMPLATE-ENGINE: content[%s]()=%d - CALLED!', gettype($content), strlen($content)));
if (empty($content)) {
* @param $xmlCompacting New XML compacting setting
* @return void
*/
- public final function enableXmlCompacting (bool $xmlCompacting = true) {
+ public final function enableXmlCompacting (bool $xmlCompacting = true): void {
$this->xmlCompacting = $xmlCompacting;
}
*
* @return $xmlCompacting Whether XML compacting is enabled or disabled
*/
- public final function isXmlCompactingEnabled () {
+ public final function isXmlCompactingEnabled (): bool {
return $this->xmlCompacting;
}
* @return void
* @throws XmlParserException If an XML error was found
*/
- function parseXmlContent (string $content);
+ function parseXmlContent (string $content): void;
}
* @param $languageSupport New language support setting
* @return void
*/
- function enableLanguageSupport (bool $languageSupport = true);
+ function enableLanguageSupport (bool $languageSupport = true): void;
/**
* Checks whether language support is enabled
*
* @return $languageSupport Whether language support is enabled or disabled
*/
- function isLanguageSupportEnabled ();
+ function isLanguageSupportEnabled (): bool;
/**
* Getter for given variable group
* @return void
* @throws XmlParserException If an XML error was found
*/
- function renderXmlContent (string $content = '');
+ function renderXmlContent (string $content = ''): void;
/**
* Enables or disables XML compacting
* @param $xmlCompacting New XML compacting setting
* @return void
*/
- function enableXmlCompacting (bool $xmlCompacting = true);
+ function enableXmlCompacting (bool $xmlCompacting = true): void;
/**
* Checks whether XML compacting is enabled
*
* @return $xmlCompacting Whether XML compacting is enabled or disabled
*/
- function isXmlCompactingEnabled ();
+ function isXmlCompactingEnabled (): bool;
/**
* Removes all comments, tabs and new-line charcters to compact the content
* @param $uncompactedContent The uncompacted content
* @return $compactedContent The compacted content
*/
- function compactContent (string $uncompactedContent);
+ function compactContent (string $uncompactedContent): string;
}