// Is it null?
if (empty($configKey)) {
// Entry is empty
- throw new InvalidArgumentException('configKey is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY);
+ throw new InvalidArgumentException('Parameter "configKey" is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY);
}
// Is it set?
//* NOISY-DEBUG: */ printf('[%s:%d]: configKey=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $configKey);
if (empty($configKey)) {
// Entry is empty
- throw new InvalidArgumentException('configKey is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY);
+ throw new InvalidArgumentException('Parameter "configKey" is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY);
}
// Convert dashes to underscore
//* NOISY-DEBUG: */ printf('[%s:%d]: configKey=%s,configValue[]=%s' . PHP_EOL, __METHOD__, __LINE__, $configKey, gettype($configValue));
if (empty($configKey)) {
// Entry is empty
- throw new InvalidArgumentException('configKey is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY);
+ throw new InvalidArgumentException('Parameter "configKey" is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY);
} elseif ((is_array($configValue)) || (is_object($configValue)) || (is_resource($configValue))) {
// These cannot be set as this is not intended for configuration values, please use FrameworkArrayObject instead.
throw new InvalidArgumentException(sprintf('configValue[]=%s for configKey=%s is not supported.', gettype($configValue), $configKey), self::EXCEPTION_CONFIG_VALUE_TYPE_UNSUPPORTED);
//* NOISY-DEBUG: */ printf('[%s:%d]: configKey=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $configKey);
if (empty($configKey)) {
// Entry is empty
- throw new InvalidArgumentException('configKey is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY);
+ throw new InvalidArgumentException('Parameter "configKey" is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY);
}
// Convert dashes to underscore
// Import framework stuff
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
-use Org\Mxchange\CoreFramework\Criteria\Criteria;
use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
use Org\Mxchange\CoreFramework\Filesystem\PathWriteProtectedException;
return $isBase64;
}
- /**
- * Gets a cache key from Criteria instance
- *
- * @param $criteriaInstance An instance of a Criteria class
- * @param $onlyKeys Only use these keys for a cache key
- * @return $cacheKey A cache key suitable for lookup/storage purposes
- */
- protected function getCacheKeyByCriteria (Criteria $criteriaInstance, array $onlyKeys = []) {
- // Generate it
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FRAMEWORK-SYSTEM: criteriaInstance=' . $criteriaInstance->__toString() . ',onlyKeys()=' . count($onlyKeys) . ' - CALLED!');
- $cacheKey = sprintf('%s@%s',
- $this->__toString(),
- $criteriaInstance->getCacheKey($onlyKeys)
- );
-
- // And return it
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FRAMEWORK-SYSTEM: cacheKey=' . $cacheKey . ' - EXIT!');
- return $cacheKey;
- }
-
/**
* Getter for startup time in miliseconds
*
return $this->tableName;
}
+ /**
+ * Gets a cache key from Criteria instance
+ *
+ * @param $criteriaInstance An instance of a Criteria class
+ * @param $onlyKeys Only use these keys for a cache key
+ * @return $cacheKey A cache key suitable for lookup/storage purposes
+ */
+ protected function getCacheKeyByCriteria (Criteria $criteriaInstance, array $onlyKeys = []) {
+ // Generate it
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FRAMEWORK-SYSTEM: criteriaInstance=' . $criteriaInstance->__toString() . ',onlyKeys()=' . count($onlyKeys) . ' - CALLED!');
+ $cacheKey = sprintf('%s@%s',
+ $this->__toString(),
+ $criteriaInstance->getCacheKey($onlyKeys)
+ );
+
+ // And return it
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FRAMEWORK-SYSTEM: cacheKey=' . $cacheKey . ' - EXIT!');
+ return $cacheKey;
+ }
+
/**
* 'Inserts' a data set instance into a local file database folder
*
// Import framework stuff
use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
+// Import SPL stuff
+use \InvalidArgumentException;
+
/**
* A general (base) factory
*
* Count given object
*
* @param $fullClassName Name of the class we shall count
+ * @return void
+ * @throws InvalidArgumentException If a parameter is not valid
*/
protected static final function countObject (string $fullClassName) {
+ // Is the parameter valid?
+ if (empty($fullClassName)) {
+ // No empty class name
+ throw new InvalidArgumentException('fullClassName is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY);
+ }
+
// Count it up in total sum
self::$total++;
*
* @param $fullClassName Full name of class
* @return $isCounted Whether given class name is counted
+ * @throws InvalidArgumentException If a parameter is not valid
*/
- protected static final function isClassCounted (string $fullClassName) {
+ public static final function isClassCounted (string $fullClassName) {
+ // Is the parameter valid?
+ if (empty($fullClassName)) {
+ // No empty class name
+ throw new InvalidArgumentException('fullClassName is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY);
+ }
+
// Return isset() result
return isset(self::$objectCounters[$fullClassName]);
}
*/
private $xmlCompacting = false;
+ /**
+ * Method name for XML template type
+ */
+ private $initMethodName = 'invalid';
+
/**
* Protected constructor
*
// Set XML template type and prefix
$this->xmlTemplateType = $xmlTemplateType;
$this->typePrefix = $typePrefix;
+ $this->initMethodName = sprintf('init%s', StringUtils::convertToClassName($this->xmlTemplateType));
// Get template instance
$applicationInstance = ApplicationHelper::getSelfInstance();
*/
public final function startElement ($resource, string $element, array $attributes) {
// Initial method name which will never be called...
- $methodName = 'init' . StringUtils::convertToClassName($this->xmlTemplateType);
+ $methodName = $this->initMethodName;
// Make the element name lower-case
$element = strtolower($element);
* @return $className Generated class name
*/
public static final function convertToClassName (string $str) {
+ // Is the parameter valid?
+ /* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('STRING-UTILS: str=%s - CALLED!', $str));
+ if (empty($str)) {
+ // No empty strings, please
+ throw new InvalidArgumentException('Parameter "str" is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY);
+ }
+
// Init class name
$className = '';
}
// Return class name
+ /* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('STRING-UTILS: className=%s - EXIT!', $className));
return $className;
}
$isInitialized = false;
// Is there a valid output instance provided?
- if ((!is_null($outputClass)) && (is_object($outputClass)) && ($outputClass instanceof OutputStreamer)) {
- // Use the given output instance
- $debugInstance->setOutputInstance($outputClass);
-
- // All fine
- $isInitialized = true;
- } elseif (class_exists($outputClass)) {
+ if (class_exists($outputClass)) {
// A name for a debug output class has been provided so we try to get it
$outputInstance = ObjectFactory::createObjectByName($outputClass);