+ /**
+ * Checks if a configuration entry is_*_enabled set to 'Y'
+ *
+ * @param $keyPart Configuration to expand with is_$keyPart_enabled
+ * @return $enabled Whether it has been set to Y or N
+ * @throws InvalidArgumentException If a parameter is invalid
+ * @throws UnexpectedValueException If a returned value is of an unexpected type or value
+ */
+ public function isEnabled (string $keyPart) {
+ // Validate parameters
+ //* NOISY-DEBUG: */ printf('[%s:%d]: keyPart=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $keyPart);
+ if (empty($keyPart)) {
+ // Entry is empty
+ throw new InvalidArgumentException('Parameter "keyPart" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
+ }
+
+ // Construct final config key
+ $configKey = sprintf('is_%s_enabled', $keyPart);
+
+ // Get value from it
+ //* NOISY-DEBUG: */ printf('[%s:%d]: configKey=%s' . PHP_EOL, __METHOD__, __LINE__, $configKey);
+ $isEnabled = $this->getConfigEntry($configKey);
+
+ // Is it Y/N?
+ //* NOISY-DEBUG: */ printf('[%s:%d]: isEnabled[]=%s' . PHP_EOL, __METHOD__, __LINE__, gettype($isEnabled));
+ if (!is_bool($isEnabled)) {
+ // Throw exception
+ throw new UnexpectedValueException(sprintf('isEnabled[]=%s is unexpected', gettype($isEnabled)), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE);
+ }
+
+ // Return it
+ //* NOISY-DEBUG: */ printf('[%s:%d]: isEnabled=%d - EXIT!' . PHP_EOL, __METHOD__, __LINE__, intval($isEnabled));
+ return $isEnabled;
+ }
+