// Import framework stuff
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
-use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
use Org\Mxchange\CoreFramework\Filesystem\InvalidDirectoryException;
+use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
+use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
use Org\Mxchange\CoreFramework\Image\BaseImage;
+use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware;
use Org\Mxchange\CoreFramework\Parser\Parseable;
-use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
use Org\Mxchange\CoreFramework\Response\Responseable;
use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
use Org\Mxchange\CoreFramework\Template\Engine\BaseTemplateEngine;
-use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
+use Org\Mxchange\CoreFramework\Utils\Strings\StringUtils;
// Import SPL stuff
use \SplFileInfo;
*
* @author Roland Haeder <webmaster@shipsimu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2023 Core Developer Team
* @license GNU GPL 3.0 or any newer version
* @link http://www.shipsimu.org
*
*
* @return void
*/
- protected function __construct () {
+ private function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
}
$templateInstance = new ImageTemplateEngine();
// Get the application instance from registry
- $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+ $applicationInstance = ApplicationHelper::getSelfInstance();
// Determine base path
$templateBasePath = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('application_base_path') . $applicationInstance->getAppShortName(). '/';
// Is the base path valid?
if (empty($templateBasePath)) {
// Base path is empty
- throw new UnexpectedValueException(sprintf('[%s:%d] Variable templateBasePath is empty.', $templateInstance->__toString(), __LINE__), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- } elseif (!is_string($templateBasePath)) {
- // Is not a string
- throw new UnexpectedValueException(sprintf('[%s:%d] %s is not a string with a base path.', $templateInstance->__toString(), __LINE__, $templateBasePath), self::EXCEPTION_INVALID_STRING);
+ throw new UnexpectedValueException(sprintf('[%s:%d] Variable templateBasePath is empty.', $templateInstance->__toString(), __LINE__), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE);
} elseif (!is_dir($templateBasePath)) {
// Is not a path
throw new InvalidDirectoryException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME);
$methodName = 'setImageProperty' . StringUtils::convertToClassName($element);
} elseif ($element != 'image') {
// Invalid node name found
- throw new InvalidXmlNodeException(array($this, $element, $attributes), Parseable::EXCEPTION_XML_NODE_UNKNOWN);
+ throw new InvalidXmlNodeException([$this, $element, $attributes], Parseable::EXCEPTION_XML_NODE_UNKNOWN);
}
// Call method
* @return void
* @todo Find something usefull with this!
*/
- public function characterHandler ($resource, $characters) {
+ public function characterHandler ($resource, string $characters) {
// Trim all spaces away
$characters = trim($characters);
if (empty($characters)) {
// Then skip it silently
return;
- } // END - if
+ }
// Unfinished work!
- $this->partialStub('Handling extra characters is not yet supported!');
+ DebugMiddleware::getSelfInstance()->partialStub('Handling extra characters is not yet supported!');
}
/**
* @param $imageType Code fragment or direct value holding the image type
* @return void
*/
- private function setImageType ($imageType) {
+ private function setImageType (string $imageType) {
// Set group to general
$this->setVariableGroup('general');
$className = StringUtils::convertToClassName($imageType.'_image');
// And try to initiate it
- $this->setImageInstance(ObjectFactory::createObjectByName($className, array($this)));
+ $this->setImageInstance(ObjectFactory::createObjectByName($className, [$this]));
// Set current main node to type
$this->currMainNode = 'type';
* @return void
* @see ImageTemplateEngine::setImageResolution
*/
- private function setImageImageString ($groupable = 'single') {
+ private function setImageImageString (string $groupable = 'single') {
// Call the image class
$this->getImageInstance()->initImageString($groupable);
* @param $imageName Name of the image
* @return void
*/
- private function setImagePropertyName ($imageName) {
+ private function setImagePropertyName (string $imageName) {
// Call the image class
$this->getImageInstance()->setImageName($imageName);
}
* @param $width Width of the image or variable
* @return void
*/
- private function setImagePropertyWidth ($width) {
+ private function setImagePropertyWidth (int $width) {
// Call the image class
$this->getImageInstance()->setWidth($width);
}
* @param $height Height of the image or variable
* @return void
*/
- private function setImagePropertyHeight ($height) {
+ private function setImagePropertyHeight (int $height) {
// Call the image class
$this->getImageInstance()->setHeight($height);
}
* @param $stringName String name (identifier)
* @return void
*/
- private function setImagePropertyStringName ($stringName) {
+ private function setImagePropertyStringName (string $stringName) {
// Call the image class
$this->getImageInstance()->setStringName($stringName);
}
* @param $fontSize Size of the font
* @return void
*/
- private function setImagePropertyFontSize ($fontSize) {
+ private function setImagePropertyFontSize (int $fontSize) {
// Call the image class
$this->getImageInstance()->setFontSize($fontSize);
}
* @param $imageString Image string to set
* @return void
*/
- private function setImagePropertyText ($imageString) {
+ private function setImagePropertyText (string $imageString) {
// Call the image class
$this->getImageInstance()->setString($imageString);
}
* @param $x X coordinate
* @return void
*/
- private function setImagePropertyX ($x) {
+ private function setImagePropertyX (int $x) {
// Call the image class
$this->getImageInstance()->setX($x);
}
* @param $y Y coordinate
* @return void
*/
- private function setImagePropertyY ($y) {
+ private function setImagePropertyY (int $y) {
// Call the image class
$this->getImageInstance()->setY($y);
}
* located in 'image' by default
* @return void
*/
- public function loadImageTemplate ($template) {
+ public function loadImageTemplate (string $template) {
// Set template type
$this->setTemplateType(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('image_template_type'));