// Import framework stuff
use Org\Mxchange\CoreFramework\Configuration\NoConfigEntryException;
use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
-use Org\Mxchange\CoreFramework\Generic\NullPointerException;
use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
use Org\Mxchange\CoreFramework\Registry\Registerable;
*
* @param $configKey The configuration key we shall check
* @return $isset Whether the given configuration key is set
- * @throws NullPointerException If $configKey is NULL
* @throws InvalidArgumentException If $configKey is empty
*/
- public function isConfigurationEntrySet ($configKey) {
+ public function isConfigurationEntrySet (string $configKey) {
// Is it null?
- if (is_null($configKey)) {
- // Throw NPE
- throw new NullPointerException($this, BaseFrameworkSystem::EXCEPTION_IS_NULL_POINTER);
- } elseif (!is_string($configKey)) {
- // Is not a string
- throw new InvalidArgumentException(sprintf('configKey[]=%s is not a string', gettype($configKey)), self::EXCEPTION_CONFIG_KEY_IS_EMPTY);
- } elseif ((is_string($configKey)) && (empty($configKey))) {
+ if (empty($configKey)) {
// Entry is empty
throw new InvalidArgumentException('configKey is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY);
}
*
* @param $configKey The configuration element
* @return $configValue The fetched configuration value
- * @throws NullPointerException If $configKey is NULL
* @throws InvalidArgumentException If $configKey is empty
* @throws NoConfigEntryException If a configuration element was not found
*/
- public function getConfigEntry ($configKey) {
+ public function getConfigEntry (string $configKey) {
// Is it null?
- if (is_null($configKey)) {
- // Throw NPE
- throw new NullPointerException($this, BaseFrameworkSystem::EXCEPTION_IS_NULL_POINTER);
- } elseif (!is_string($configKey)) {
- // Is not a string
- throw new InvalidArgumentException(sprintf('configKey[]=%s is not a string', gettype($configKey)), self::EXCEPTION_CONFIG_KEY_IS_EMPTY);
- } elseif ((is_string($configKey)) && (empty($configKey))) {
+ if (empty($configKey)) {
// Entry is empty
throw new InvalidArgumentException('configKey is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY);
}
* @param $configKey The configuration key we want to add/change
* @param $configValue The configuration value we want to set
* @return void
- * @throws NullPointerException If $configKey is NULL
* @throws InvalidArgumentException If $configKey is empty
* @throws InvalidArgumentException If $configValue has an unsupported variable type
*/
- public final function setConfigEntry ($configKey, $configValue) {
+ public final function setConfigEntry (string $configKey, $configValue) {
// Is a valid configuration key key provided?
- if (is_null($configKey)) {
- // Configuration key is null
- throw new NullPointerException($this, BaseFrameworkSystem::EXCEPTION_IS_NULL_POINTER);
- } elseif (!is_string($configKey)) {
- // Is not a string
- throw new InvalidArgumentException(sprintf('configKey[]=%s is not a string', gettype($configKey)), self::EXCEPTION_CONFIG_KEY_IS_EMPTY);
- } elseif ((is_string($configKey)) && (empty($configKey))) {
+ if (empty($configKey)) {
// Entry is empty
throw new InvalidArgumentException('configKey is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY);
} elseif ((is_array($configValue)) || (is_object($configValue)) || (is_resource($configValue))) {
*
* @param $configKey Configuration key to unset
* @return void
- * @throws NullPointerException If $configKey is NULL
* @throws InvalidArgumentException If $configKey is empty
* @throws NoConfigEntryException If a configuration element was not found
*/
- public final function unsetConfigEntry ($configKey) {
+ public final function unsetConfigEntry (string $configKey) {
// Validate parameters
- if (is_null($configKey)) {
- // Configuration key is null
- throw new NullPointerException($this, BaseFrameworkSystem::EXCEPTION_IS_NULL_POINTER);
- } elseif (!is_string($configKey)) {
- // Entry is empty
- throw new InvalidArgumentException(sprintf('configKey[]=%s is not a string', gettype($configKey)), self::EXCEPTION_CONFIG_KEY_IS_EMPTY);
- } elseif ((is_string($configKey)) && (empty($configKey))) {
+ if (empty($configKey)) {
// Entry is empty
throw new InvalidArgumentException('configKey is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY);
}
unset(self::$config[$configKey]);
}
- /**
- * Getter for field name
- *
- * @param $fieldName Field name which we shall get
- * @return $fieldValue Field value from the user
- * @throws NullPointerException If the result instance is null
- */
- public final function getField ($fieldName) {
- // The super interface "FrameworkInterface" requires this
- throw new UnsupportedOperationException(array($this, __FUNCTION__), BaseFrameworkSystem::EXCEPTION_UNSPPORTED_OPERATION);
- }
-
- /**
- * Checks if given field is set
- *
- * @param $fieldName Field name to check
- * @return $isSet Whether the given field name is set
- * @throws NullPointerException If the result instance is null
- */
- public function isFieldSet ($fieldName) {
- // The super interface "FrameworkInterface" requires this
- throw new UnsupportedOperationException(array($this, __FUNCTION__), BaseFrameworkSystem::EXCEPTION_UNSPPORTED_OPERATION);
- }
-
/**
* Generates a code for hashes from this class
*
$this->callbackInstance = $callbackInstance;
}
+ /**
+ * Getter for field name
+ *
+ * @param $fieldName Field name which we shall get
+ * @return $fieldValue Field value from the user
+ * @throws NullPointerException If the result instance is null
+ */
+ public final function getField (string $fieldName) {
+ // The super interface "FrameworkInterface" requires this
+ throw new UnsupportedOperationException(array($this, __FUNCTION__), BaseFrameworkSystem::EXCEPTION_UNSPPORTED_OPERATION);
+ }
+
+ /**
+ * Checks if given field is set
+ *
+ * @param $fieldName Field name to check
+ * @return $isSet Whether the given field name is set
+ * @throws NullPointerException If the result instance is null
+ */
+ public function isFieldSet (string $fieldName) {
+ // The super interface "FrameworkInterface" requires this
+ throw new UnsupportedOperationException(array($this, __FUNCTION__), BaseFrameworkSystem::EXCEPTION_UNSPPORTED_OPERATION);
+ }
+
}