- added more debug lines
- used lesser deprecated debugOutput() and more propper logging level methods
*/
protected function __construct (string $className) {
// Call parent constructor
*/
protected function __construct (string $className) {
// Call parent constructor
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: className=%s - CONSTRUCTED!', $className));
parent::__construct($className);
// Initialize valid criteria types array
self::$CRITERIA_TYPES = [Criteria::CRITERIA_TYPE_DEFAULT, Criteria::CRITERIA_TYPE_CHOICE, Criteria::CRITERIA_TYPE_EXCLUDE];
// Initialize all criteria arrays
parent::__construct($className);
// Initialize valid criteria types array
self::$CRITERIA_TYPES = [Criteria::CRITERIA_TYPE_DEFAULT, Criteria::CRITERIA_TYPE_CHOICE, Criteria::CRITERIA_TYPE_EXCLUDE];
// Initialize all criteria arrays
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-CRITERIA: self::CRITERIA_TYPES()=%d', count(self::$CRITERIA_TYPES)));
foreach (self::$CRITERIA_TYPES as $criteriaType) {
// Init it
foreach (self::$CRITERIA_TYPES as $criteriaType) {
// Init it
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: Initializing criteriaType=%s ...', $criteriaType));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: Invoking this->initGenericArrayKey(criteria,%s,entries) ...', $criteriaType));
$this->initGenericArrayKey('criteria', $criteriaType, 'entries');
}
$this->initGenericArrayKey('criteria', $criteriaType, 'entries');
}
+
+ // Trace message
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-CRITERIA: EXIT!');
*/
protected final function count (string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT) {
// Check parameter
*/
protected final function count (string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT) {
// Check parameter
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: criteriaType=%s - CALLED!', strtoupper($criteriaType), $criteriaType));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: criteriaType=%s - CALLED!', strtoupper($criteriaType), $criteriaType));
if (empty($criteriaType)) {
// Throw it again
throw new InvalidArgumentException('Parameter "criteriaType" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
if (empty($criteriaType)) {
// Throw it again
throw new InvalidArgumentException('Parameter "criteriaType" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: Invoking this->countGenericArrayGroup(criteria, %s) ...', strtoupper($criteriaType), $criteriaType));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: Invoking this->countGenericArrayGroup(criteria, %s) ... - EXIT!', strtoupper($criteriaType), $criteriaType));
return $this->countGenericArrayGroup('criteria', $criteriaType);
}
return $this->countGenericArrayGroup('criteria', $criteriaType);
}
*/
public function isKeySet (string $criteriaType, string $criteriaKey) {
// Check parameters
*/
public function isKeySet (string $criteriaType, string $criteriaKey) {
// Check parameters
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: criteriaType=%s,criteriaKey=%s - CALLED!', strtoupper($criteriaType), $criteriaType, $criteriaKey));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: criteriaType=%s,criteriaKey=%s - CALLED!', strtoupper($criteriaType), $criteriaType, $criteriaKey));
if (empty($criteriaType)) {
// Throw it again
throw new InvalidArgumentException('Parameter "criteriaType" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
if (empty($criteriaType)) {
// Throw it again
throw new InvalidArgumentException('Parameter "criteriaType" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: Invoking this->isGenericArrayElementSet(criteria,%s,entries,%s) ...', strtoupper($criteriaType), $criteriaType, $criteriaKey));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-CRITERIA: Invoking this->isGenericArrayElementSet(criteria,%s,entries,%s) ...', strtoupper($criteriaType), $criteriaType, $criteriaKey));
$isset = $this->isGenericArrayElementSet('criteria', $criteriaType, 'entries', $criteriaKey);
// Return it
$isset = $this->isGenericArrayElementSet('criteria', $criteriaType, 'entries', $criteriaKey);
// Return it
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: isset=%d - EXIT!', strtoupper($criteriaType), intval($isset)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: isset=%d - EXIT!', strtoupper($criteriaType), intval($isset)));
*/
public function isChoiceKeySet (string $criteriaKey) {
// Validate parameter
*/
public function isChoiceKeySet (string $criteriaKey) {
// Validate parameter
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: criteriaKey=%s - CALLED!', $criteriaKey));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: criteriaKey=%s - CALLED!', $criteriaKey));
if (empty($criteriaKey)) {
// Throw it again
throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
}
// Invoke inner method
if (empty($criteriaKey)) {
// Throw it again
throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
}
// Invoke inner method
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: Invoking this->isKeySet(%s,%s) ...', Criteria::CRITERIA_TYPE_CHOICE, $criteriaKey));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: Invoking this->isKeySet(%s,%s) ...', Criteria::CRITERIA_TYPE_CHOICE, $criteriaKey));
return $this->isKeySet(Criteria::CRITERIA_TYPE_CHOICE, $criteriaKey);
}
return $this->isKeySet(Criteria::CRITERIA_TYPE_CHOICE, $criteriaKey);
}
*/
public function isExcludeKeySet (string $criteriaKey) {
// Validate parameter
*/
public function isExcludeKeySet (string $criteriaKey) {
// Validate parameter
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: criteriaKey=%s - CALLED!', $criteriaKey));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: criteriaKey=%s - CALLED!', $criteriaKey));
if (empty($criteriaKey)) {
// Throw it again
throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
}
// Invoke inner method
if (empty($criteriaKey)) {
// Throw it again
throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
}
// Invoke inner method
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: Invoking this->isKeySet(%s,%s) ...', Criteria::CRITERIA_TYPE_EXCLUDE, $criteriaKey));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: Invoking this->isKeySet(%s,%s) ... - EXIT!', Criteria::CRITERIA_TYPE_EXCLUDE, $criteriaKey));
return $this->isKeySet(Criteria::CRITERIA_TYPE_EXCLUDE, $criteriaKey);
}
return $this->isKeySet(Criteria::CRITERIA_TYPE_EXCLUDE, $criteriaKey);
}
*/
public final function getCriteriaArray (string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT) {
// Check parameters
*/
public final function getCriteriaArray (string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT) {
// Check parameters
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: criteriaType=%s - CALLED!', strtoupper($criteriaType), $criteriaType));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: criteriaType=%s - CALLED!', strtoupper($criteriaType), $criteriaType));
if (empty($criteriaType)) {
// Throw it again
throw new InvalidArgumentException('Parameter "criteriaType" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
if (empty($criteriaType)) {
// Throw it again
throw new InvalidArgumentException('Parameter "criteriaType" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: Invoking this->getGenericArrayKey(criteria,%s,entries) ...', strtoupper($criteriaType), $criteriaType));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: Invoking this->getGenericArrayKey(criteria,%s,entries) ... - EXIT!', strtoupper($criteriaType), $criteriaType));
return $this->getGenericArrayKey('criteria', $criteriaType, 'entries');
}
return $this->getGenericArrayKey('criteria', $criteriaType, 'entries');
}
* @return $criteria
*/
public final function getCriteriaChoiceArray () {
* @return $criteria
*/
public final function getCriteriaChoiceArray () {
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: CALLED!', strtoupper($criteriaType)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: CALLED!', strtoupper($criteriaType)));
return $this->getCriteriaArray(Criteria::CRITERIA_TYPE_CHOICE);
}
return $this->getCriteriaArray(Criteria::CRITERIA_TYPE_CHOICE);
}
* @return $criteria
*/
public final function getCriteriaExcludeArray () {
* @return $criteria
*/
public final function getCriteriaExcludeArray () {
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: CALLED!', strtoupper($criteriaType)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-CRITERIA: CALLED!');
return $this->getCriteriaArray(Criteria::CRITERIA_TYPE_EXCLUDE);
}
return $this->getCriteriaArray(Criteria::CRITERIA_TYPE_EXCLUDE);
}
*/
public final function unsetCriteria (string $criteriaKey) {
// Check parameter
*/
public final function unsetCriteria (string $criteriaKey) {
// Check parameter
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: criteriaKey=%s - CALLED!', $criteriaKey));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: criteriaKey=%s - CALLED!', $criteriaKey));
if (empty($criteriaKey)) {
// Throw it again
throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
if (empty($criteriaKey)) {
// Throw it again
throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
}
// Convert dashes to underscore
}
// Convert dashes to underscore
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: Invoking StringUtils::convertDashesToUnderscores(%s) ...', strtoupper($criteriaType), $criteriaKey));
$criteriaKey = StringUtils::convertDashesToUnderscores($criteriaKey);
// "Walk" through all criterias
$criteriaKey = StringUtils::convertDashesToUnderscores($criteriaKey);
// "Walk" through all criterias
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: criteriaKey=%s', strtoupper($criteriaType), $criteriaKey));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-CRITERIA: criteriaKey=%s', strtoupper($criteriaType), $criteriaKey));
foreach ($this->getGenericArray('criteria') as $criteriaType => $dummy) {
// Remove it
foreach ($this->getGenericArray('criteria') as $criteriaType => $dummy) {
// Remove it
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: Removing criteriaType=%s,criteriaKey=%s ...', strtoupper($criteriaType), $criteriaType, $criteriaKey));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: Removing criteriaType=%s,criteriaKey=%s ...', strtoupper($criteriaType), $criteriaType, $criteriaKey));
$this->unsetGenericArrayElement('criteria', $criteriaType, 'entries', $criteriaKey);
}
// Trace message
$this->unsetGenericArrayElement('criteria', $criteriaType, 'entries', $criteriaKey);
}
// Trace message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-CRITERIA: EXIT!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-CRITERIA: EXIT!');
*/
public final function addCriteria (string $criteriaKey, $criteriaValue, string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT) {
// Check parameter
*/
public final function addCriteria (string $criteriaKey, $criteriaValue, string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT) {
// Check parameter
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: criteriaKey=%s,criteriaValue[]=%s,criteriaType=%s - CALLED!', strtoupper($criteriaType), $criteriaKey, gettype($criteriaValue), $criteriaType));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: criteriaKey=%s,criteriaValue[]=%s,criteriaType=%s - CALLED!', strtoupper($criteriaType), $criteriaKey, gettype($criteriaValue), $criteriaType));
if (empty($criteriaKey)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
if (empty($criteriaKey)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
}
// Convert dashes to underscore
}
// Convert dashes to underscore
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: Invoking StringUtils::convertDashesToUnderscores(%s) ...', strtoupper($criteriaType), $criteriaKey));
$criteriaKey = StringUtils::convertDashesToUnderscores($criteriaKey);
// Set it
$criteriaKey = StringUtils::convertDashesToUnderscores($criteriaKey);
// Set it
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: Invoking this->setGenericArrayElement(criteria,%s,entries,%s,criteriaValue[]=%s) ...', strtoupper($criteriaType), $criteriaType, $criteriaKey, gettype($criteriaValue)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: Invoking this->setGenericArrayElement(criteria,%s,entries,%s,criteriaValue[]=%s) ...', strtoupper($criteriaType), $criteriaType, $criteriaKey, gettype($criteriaValue)));
$this->setGenericArrayElement('criteria', $criteriaType, 'entries', $criteriaKey, $criteriaValue);
// Trace message
$this->setGenericArrayElement('criteria', $criteriaType, 'entries', $criteriaKey, $criteriaValue);
// Trace message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: EXIT!', strtoupper($criteriaType)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: EXIT!', strtoupper($criteriaType)));
*/
public final function setCriteria (string $criteriaKey, $criteriaValue, string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT) {
// Check parameter
*/
public final function setCriteria (string $criteriaKey, $criteriaValue, string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT) {
// Check parameter
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: criteriaKey=%s,criteriaValue[]=%s$criteriaValue,criteriaType=%s - CALLED!', strtoupper($criteriaType), $criteriaKey, gettype($criteriaValue), $criteriaType));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: criteriaKey=%s,criteriaValue[]=%s$criteriaValue,criteriaType=%s - CALLED!', strtoupper($criteriaType), $criteriaKey, gettype($criteriaValue), $criteriaType));
if (empty($criteriaKey)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
if (empty($criteriaKey)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
}
// Convert dashes to underscore
}
// Convert dashes to underscore
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: Invoking StringUtils::convertDashesToUnderscores(%s) ...', strtoupper($criteriaType), $criteriaKey));
$criteriaKey = StringUtils::convertDashesToUnderscores($criteriaKey);
// Set it
$criteriaKey = StringUtils::convertDashesToUnderscores($criteriaKey);
// Set it
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: Invoking this->setGenericArrayElement(criteria,%s,entries,%s,criteriaValue[]=%s) ...', strtoupper($criteriaType), $criteriaKey, gettype($criteriaValue)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: Invoking this->setGenericArrayElement(criteria,%s,entries,%s,criteriaValue[]=%s) ...', strtoupper($criteriaType), $criteriaKey, gettype($criteriaValue)));
$this->setGenericArrayElement('criteria', $criteriaType, 'entries', $criteriaKey, $criteriaValue);
// Trace message
$this->setGenericArrayElement('criteria', $criteriaType, 'entries', $criteriaKey, $criteriaValue);
// Trace message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-CRITERIA: EXIT!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-CRITERIA: EXIT!');
*/
public final function addChoiceCriteria (string $criteriaKey, $criteriaValue) {
// Check parameter
*/
public final function addChoiceCriteria (string $criteriaKey, $criteriaValue) {
// Check parameter
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: criteriaKey=%s,criteriaValue[]=%s - CALLED!', $criteriaKey, gettype($criteriaValue)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: criteriaKey=%s,criteriaValue[]=%s - CALLED!', $criteriaKey, gettype($criteriaValue)));
if (empty($criteriaKey)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
if (empty($criteriaKey)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
throw new UnexpectedValueException(sprintf('criteriaValue[]=%s is not accepted', gettype($criteriaValue)));
}
throw new UnexpectedValueException(sprintf('criteriaValue[]=%s is not accepted', gettype($criteriaValue)));
}
+ // Convert dashes to underscore
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: Invoking StringUtils::convertDashesToUnderscores(%s) ...', $criteriaKey));
+ $criteriaKey = StringUtils::convertDashesToUnderscores($criteriaKey);
+
- $this->pushValueToGenericArrayElement('criteria', Criteria::CRITERIA_TYPE_CHOICE, 'entries', StringUtils::convertDashesToUnderscores($criteriaKey), (string) $criteriaValue);
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: Invoking this->pushValueToGenericArrayElement(criteria,%s,entries,%s,criteriaValue[]=%s) ...', Criteria::CRITERIA_TYPE_CHOICE, $criteriaKey, gettype($criteriaValue)));
+ $this->pushValueToGenericArrayElement('criteria', Criteria::CRITERIA_TYPE_CHOICE, 'entries', $criteriaKey, $criteriaValue);
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-CRITERIA: EXIT!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-CRITERIA: EXIT!');
*/
public final function addExcludeCriteria (string $criteriaKey, $criteriaValue) {
// Check parameter
*/
public final function addExcludeCriteria (string $criteriaKey, $criteriaValue) {
// Check parameter
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: criteriaKey=%s,criteriaValue[%s]=%s - CALLED!', $criteriaKey, gettype($criteriaValue), $criteriaValue));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: criteriaKey=%s,criteriaValue[%s]=%s - CALLED!', $criteriaKey, gettype($criteriaValue), $criteriaValue));
if (empty($criteriaKey)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
if (empty($criteriaKey)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
}
// Add it with generic method
}
// Add it with generic method
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: Invoking this->addCriteria(%s,criteriaValue[]=%s,%s) ...', $criteriaKey, gettype($criteriaValue), Criteria::CRITERIA_TYPE_EXCLUDE));
$this->addCriteria($criteriaKey, $criteriaValue, Criteria::CRITERIA_TYPE_EXCLUDE);
// Trace message
$this->addCriteria($criteriaKey, $criteriaValue, Criteria::CRITERIA_TYPE_EXCLUDE);
// Trace message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-CRITERIA: EXIT!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-CRITERIA: EXIT!');
*/
public final function addConfiguredCriteria (string $criteriaKey, string $configEntry, string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT) {
// Check parameter
*/
public final function addConfiguredCriteria (string $criteriaKey, string $configEntry, string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT) {
// Check parameter
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: criteriaKey=%s,configEntry=%s,criteriaType=%s - CALLED!', strtoupper($criteriaType), $criteriaKey, $configEntry, $criteriaType));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: criteriaKey=%s,configEntry=%s,criteriaType=%s - CALLED!', strtoupper($criteriaType), $criteriaKey, $configEntry, $criteriaType));
if (empty($criteriaKey)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
if (empty($criteriaKey)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
$value = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($configEntry);
// Invoke inner method
$value = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($configEntry);
// Invoke inner method
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: Invoking this->addCriteria(%s,value[%s]=%s,%s) ...', strtoupper($criteriaType), $criteriaKey, gettype($value), $value, $criteriaType));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: Invoking this->addCriteria(%s,value[%s]=%s,%s) ...', strtoupper($criteriaType), $criteriaKey, gettype($value), $value, $criteriaType));
$this->addCriteria($criteriaKey, $value, $criteriaType);
// Trace message
$this->addCriteria($criteriaKey, $value, $criteriaType);
// Trace message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: EXIT!', strtoupper($criteriaType)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: EXIT!', strtoupper($criteriaType)));
*/
public function getCriteriaElemnent (string $criteriaKey, string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT) {
// Check parameter
*/
public function getCriteriaElemnent (string $criteriaKey, string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT) {
// Check parameter
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: criteriaKey=%s,criteriaType=%s - CALLED!', strtoupper($criteriaType), $criteriaKey, $criteriaType));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: criteriaKey=%s,criteriaType=%s - CALLED!', strtoupper($criteriaType), $criteriaKey, $criteriaType));
if (empty($criteriaKey)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
if (empty($criteriaKey)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
$value = false;
// Is the criteria there?
$value = false;
// Is the criteria there?
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: criteriaKey=%s,criteria()=%d', strtoupper($criteriaType), $criteriaKey, $this->countGenericArrayGroup('criteria', $criteriaType)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-CRITERIA: criteriaKey=%s,criteria()=%d', strtoupper($criteriaType), $criteriaKey, $this->countGenericArrayGroup('criteria', $criteriaType)));
if ($this->isKeySet($criteriaType, $criteriaKey)) {
// Then use it
if ($this->isKeySet($criteriaType, $criteriaKey)) {
// Then use it
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: Invoking this->getGenericArrayElement(criteria,%s,entries,%s) ...', strtoupper($criteriaType), $criteriaType, $criteriaKey));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: Invoking this->getGenericArrayElement(criteria,%s,entries,%s) ...', strtoupper($criteriaType), $criteriaType, $criteriaKey));
$value = $this->getGenericArrayElement('criteria', $criteriaType, 'entries', $criteriaKey);
}
// Return the value
$value = $this->getGenericArrayElement('criteria', $criteriaType, 'entries', $criteriaKey);
}
// Return the value
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: value[]=%s - EXIT!', strtoupper($criteriaType), gettype($value)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: value[]=%s - EXIT!', strtoupper($criteriaType), gettype($value)));
*/
public function getCriteriaChoiceElemnent (string $criteriaKey) {
// Check parameter
*/
public function getCriteriaChoiceElemnent (string $criteriaKey) {
// Check parameter
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: criteriaKey=%s - CALLED!', $criteriaKey));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: criteriaKey=%s - CALLED!', $criteriaKey));
if (empty($criteriaKey)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
if (empty($criteriaKey)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: Invoking this->getCriteriaElemnent(%s,%s) ...', $criteriaKey, Criteria::CRITERIA_TYPE_CHOICE));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: Invoking this->getCriteriaElemnent(%s,%s) ...', $criteriaKey, Criteria::CRITERIA_TYPE_CHOICE));
return $this->getCriteriaElemnent($criteriaKey, Criteria::CRITERIA_TYPE_CHOICE);
}
return $this->getCriteriaElemnent($criteriaKey, Criteria::CRITERIA_TYPE_CHOICE);
}
*/
public function getCriteriaExcludeElemnent (string $criteriaKey) {
// Check parameter
*/
public function getCriteriaExcludeElemnent (string $criteriaKey) {
// Check parameter
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: criteriaKey=%s - CALLED!', $criteriaKey));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: criteriaKey=%s - CALLED!', $criteriaKey));
if (empty($criteriaKey)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
if (empty($criteriaKey)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "criteriaKey" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: Invoking this->getCriteriaElemnent(%s,%s) ...', $criteriaKey, Criteria::CRITERIA_TYPE_EXCLUDE));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: Invoking this->getCriteriaElemnent(%s,%s) ...', $criteriaKey, Criteria::CRITERIA_TYPE_EXCLUDE));
return $this->getCriteriaElemnent($criteriaKey, Criteria::CRITERIA_TYPE_EXCLUDE);
}
return $this->getCriteriaElemnent($criteriaKey, Criteria::CRITERIA_TYPE_EXCLUDE);
}
*/
public function ifEntryMatches (array $entryArray, string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT) {
// Check parameters
*/
public function ifEntryMatches (array $entryArray, string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT) {
// Check parameters
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: entryArray()=%d,criteriaType=%s - CALLED!', strtoupper($criteriaType), count($entryArray), $criteriaType));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: entryArray()=%d,criteriaType=%s - CALLED!', strtoupper($criteriaType), count($entryArray), $criteriaType));
if (count($entryArray) == 0) {
// Throw IAE
throw new InvalidArgumentException('entryArray cannot be an empty array');
if (count($entryArray) == 0) {
// Throw IAE
throw new InvalidArgumentException('entryArray cannot be an empty array');
$counted = 0;
// Walk through all entries
$counted = 0;
// Walk through all entries
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-CRITERIA: Walking over entryArray()=%d ...', strtoupper($criteriaType), count($entryArray)));
foreach ($entryArray as $key => $entry) {
// Make sure no 'my-' or 'my_' passes this point
foreach ($entryArray as $key => $entry) {
// Make sure no 'my-' or 'my_' passes this point
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: key=%s,entry[%s]=%s', strtoupper($criteriaType), $key, gettype($entry), $entry));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-CRITERIA: key=%s,entry[%s]=%s', strtoupper($criteriaType), $key, gettype($entry), $entry));
if ((strpos($key, 'my-') !== false) || (strpos($key, 'my_') !== false)) {
// Throw it again
throw new InvalidArgumentException(sprintf('key=%s has illegal prefix "my"', $key));
}
// Convert dashes to underscore
if ((strpos($key, 'my-') !== false) || (strpos($key, 'my_') !== false)) {
// Throw it again
throw new InvalidArgumentException(sprintf('key=%s has illegal prefix "my"', $key));
}
// Convert dashes to underscore
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: Invoking StringUtils::convertDashesToUnderscores(%s) ...', strtoupper($criteriaType), $key));
$key = StringUtils::convertDashesToUnderscores($key);
// Then walk through all search criteria
$key = StringUtils::convertDashesToUnderscores($key);
// Then walk through all search criteria
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-CRITERIA: key=%s - AFTER!', strtoupper($criteriaType), $key));
foreach ($this->getGenericArrayKey('criteria', $criteriaType, 'entries') as $criteriaKey => $criteriaValue) {
// Make sure no 'my-' or 'my_' passes this point
foreach ($this->getGenericArrayKey('criteria', $criteriaType, 'entries') as $criteriaKey => $criteriaValue) {
// Make sure no 'my-' or 'my_' passes this point
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: criteriaKey=%s,criteriaValue[%s]=%s', strtoupper($criteriaType), $criteriaKey, gettype($criteriaValue), $criteriaValue));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-CRITERIA: criteriaKey=%s,criteriaValue[%s]=%s', strtoupper($criteriaType), $criteriaKey, gettype($criteriaValue), $criteriaValue));
if ((strpos($criteriaKey, 'my-') !== false) || (strpos($criteriaKey, 'my_') !== false)) {
// Throw it again
throw new UnexpectedValueException(sprintf('criteriaKey=%s has illegal prefix "my"', $criteriaKey));
}
// Convert dashes to underscore
if ((strpos($criteriaKey, 'my-') !== false) || (strpos($criteriaKey, 'my_') !== false)) {
// Throw it again
throw new UnexpectedValueException(sprintf('criteriaKey=%s has illegal prefix "my"', $criteriaKey));
}
// Convert dashes to underscore
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: Invoking StringUtils::convertDashesToUnderscores(%s) ...', strtoupper($criteriaType), $criteriaKey));
$criteriaKey = StringUtils::convertDashesToUnderscores($criteriaKey);
// Is the element found and does it match?
$criteriaKey = StringUtils::convertDashesToUnderscores($criteriaKey);
// Is the element found and does it match?
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-CRITERIA: key=%s,criteriaKey=%s', strtoupper($criteriaType), $key, $criteriaKey));
if (($key == $criteriaKey) && ($criteriaValue == $entry)) {
// Then count this one up
if (($key == $criteriaKey) && ($criteriaValue == $entry)) {
// Then count this one up
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: MATCHES!', strtoupper($criteriaType)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-CRITERIA: MATCHES!', strtoupper($criteriaType)));
$counted++;
}
}
}
// Now check if expected criteria counts match
$counted++;
}
}
}
// Now check if expected criteria counts match
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: counted=%d', strtoupper($criteriaType), $counted));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-CRITERIA: counted=%d', strtoupper($criteriaType), $counted));
$matches = ($counted == $this->countGenericArrayGroup('criteria', $criteriaType));
// Return the result
$matches = ($counted == $this->countGenericArrayGroup('criteria', $criteriaType));
// Return the result
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: matches=%d - EXIT!', strtoupper($criteriaType), intval($matches)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: matches=%d - EXIT!', strtoupper($criteriaType), intval($matches)));
*/
public function ifChoiceMatches (array $entryArray) {
// Check parameter
*/
public function ifChoiceMatches (array $entryArray) {
// Check parameter
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: entryArray()=%d - CALLED!', count($entryArray)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: entryArray()=%d - CALLED!', count($entryArray)));
if (count($entryArray) == 0) {
// Throw IAE
throw new InvalidArgumentException('entryArray cannot be an empty array');
}
// Invoke inner method
if (count($entryArray) == 0) {
// Throw IAE
throw new InvalidArgumentException('entryArray cannot be an empty array');
}
// Invoke inner method
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: Invoking this->ifEntryMatches(%d,%s) ...', count($entryArray), Criteria::CRITERIA_TYPE_CHOICE));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: Invoking this->ifEntryMatches(%d,%s) ...', count($entryArray), Criteria::CRITERIA_TYPE_CHOICE));
return $this->ifEntryMatches($entryArray, Criteria::CRITERIA_TYPE_CHOICE);
}
return $this->ifEntryMatches($entryArray, Criteria::CRITERIA_TYPE_CHOICE);
}
*/
public function ifExcludeMatches (array $entryArray) {
// Check parameter
*/
public function ifExcludeMatches (array $entryArray) {
// Check parameter
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: entryArray()=%d - CALLED!', count($entryArray)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: entryArray()=%d - CALLED!', count($entryArray)));
if (count($entryArray) == 0) {
// Throw IAE
throw new InvalidArgumentException('entryArray cannot be an empty array');
}
// Invoke inner method
if (count($entryArray) == 0) {
// Throw IAE
throw new InvalidArgumentException('entryArray cannot be an empty array');
}
// Invoke inner method
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: Invoking this->ifEntryMatches(%d,%s) ...', count($entryArray), Criteria::CRITERIA_TYPE_EXCLUDE));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: Invoking this->ifEntryMatches(%d,%s) ...', count($entryArray), Criteria::CRITERIA_TYPE_EXCLUDE));
return $this->ifEntryMatches($entryArray, Criteria::CRITERIA_TYPE_EXCLUDE);
}
return $this->ifEntryMatches($entryArray, Criteria::CRITERIA_TYPE_EXCLUDE);
}
*/
public function getCacheKey (array $onlyKeys = [], string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT) {
// Check parameters
*/
public function getCacheKey (array $onlyKeys = [], string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT) {
// Check parameters
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: onlyKeys()=%d,criteriaType=%s - CALLED!', strtoupper($criteriaType), count($onlyKeys), $criteriaType));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: onlyKeys()=%d,criteriaType=%s - CALLED!', strtoupper($criteriaType), count($onlyKeys), $criteriaType));
if (empty($criteriaType)) {
// Throw it again
throw new InvalidArgumentException('Parameter "criteriaType" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
if (empty($criteriaType)) {
// Throw it again
throw new InvalidArgumentException('Parameter "criteriaType" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
// Now walk through all criterias
foreach ($this->getGenericArrayKey('criteria', $criteriaType, 'entries') as $criteriaKey => $criteriaValue) {
// Make sure no 'my-' or 'my_' passes this point
// Now walk through all criterias
foreach ($this->getGenericArrayKey('criteria', $criteriaType, 'entries') as $criteriaKey => $criteriaValue) {
// Make sure no 'my-' or 'my_' passes this point
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: criteriaKey=%s,criteriaValue[%s]=%s', strtoupper($criteriaType), $criteriaKey, gettype($criteriaValue), $criteriaValue));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-CRITERIA: criteriaKey=%s,criteriaValue[%s]=%s', strtoupper($criteriaType), $criteriaKey, gettype($criteriaValue), $criteriaValue));
if ((strpos($criteriaKey, 'my-') !== false) || (strpos($criteriaKey, 'my_') !== false)) {
// Throw UAE
throw new UnexpectedValueException(sprintf('criteriaKey=%s has illegal prefix "my"', $criteriaKey));
if ((strpos($criteriaKey, 'my-') !== false) || (strpos($criteriaKey, 'my_') !== false)) {
// Throw UAE
throw new UnexpectedValueException(sprintf('criteriaKey=%s has illegal prefix "my"', $criteriaKey));
}
// Convert dashes to underscore
}
// Convert dashes to underscore
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: Invoking StringUtils::convertDashesToUnderscores(%s) ...', strtoupper($criteriaType), $criteriaKey));
$criteriaKey = StringUtils::convertDashesToUnderscores($criteriaKey);
// Is the value in array or is $onlyKeys empty?
$criteriaKey = StringUtils::convertDashesToUnderscores($criteriaKey);
// Is the value in array or is $onlyKeys empty?
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: criteriaKey=%s', strtoupper($criteriaType), $criteriaKey));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-CRITERIA: criteriaKey=%s', strtoupper($criteriaType), $criteriaKey));
if ((isset($onlyKeys[$criteriaKey])) || (count($onlyKeys) == 0)) {
// Add the value URL encoded to avoid any trouble with special characters
if ((isset($onlyKeys[$criteriaKey])) || (count($onlyKeys) == 0)) {
// Add the value URL encoded to avoid any trouble with special characters
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: Adding criteriaKey=%s,criteriaValue[%s]=%s to cache key ...', strtoupper($criteriaType), $criteriaKey, gettype($criteriaValue), $criteriaValue));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-CRITERIA: Adding criteriaKey=%s,criteriaValue[%s]=%s to cache key ...', strtoupper($criteriaType), $criteriaKey, gettype($criteriaValue), $criteriaValue));
$cacheKey .= sprintf('%s=%s;',
$criteriaKey,
urlencode($criteriaValue)
$cacheKey .= sprintf('%s=%s;',
$criteriaKey,
urlencode($criteriaValue)
$cacheKey = substr($cacheKey, 0, -1);
// Is the instance SearchCriteria?
$cacheKey = substr($cacheKey, 0, -1);
// Is the instance SearchCriteria?
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: cacheKey=%s,this=%s', strtoupper($criteriaType), $cacheKey, $this->__toString()));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-CRITERIA: cacheKey=%s,this=%s', strtoupper($criteriaType), $cacheKey, $this->__toString()));
if ($this instanceof SearchCriteria) {
// Check if 'limit' and 'skip' are in
if (((isset($onlyKeys['limit'])) && (isset($onlyKeys['skip']))) || (count($onlyKeys) == 0)) {
// Add limit and skip values
if ($this instanceof SearchCriteria) {
// Check if 'limit' and 'skip' are in
if (((isset($onlyKeys['limit'])) && (isset($onlyKeys['skip']))) || (count($onlyKeys) == 0)) {
// Add limit and skip values
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: Adding this->limit=%d,this->skip=%d to cache key ...', strtoupper($criteriaType), $this->getLimit(), $this->getSkip()));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-CRITERIA: Adding this->limit=%d,this->skip=%d to cache key ...', strtoupper($criteriaType), $this->getLimit(), $this->getSkip()));
$cacheKey .= sprintf(';%%limit%%=%s;%%skip%%=%s',
$this->getLimit(),
$this->getSkip()
$cacheKey .= sprintf(';%%limit%%=%s;%%skip%%=%s',
$this->getLimit(),
$this->getSkip()
}
// Return the cache key
}
// Return the cache key
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-CRITERIA: cacheKey=%s - EXIT!', strtoupper($criteriaType), $cacheKey));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: cacheKey=%s - EXIT!', strtoupper($criteriaType), $cacheKey));
*/
public function getCacheKeyChoice (array $onlyKeys = []) {
// Trace message
*/
public function getCacheKeyChoice (array $onlyKeys = []) {
// Trace message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: onlyKeys()=%d - CALLED!', count($onlyKeys)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: onlyKeys()=%d - CALLED!', count($onlyKeys)));
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: Invoking this->getCacheKey(onlyKeys()=%d,%s) ...', count($onlyKeys),Criteria::CRITERIA_TYPE_CHOICE));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: Invoking this->getCacheKey(onlyKeys()=%d,%s) ...', count($onlyKeys),Criteria::CRITERIA_TYPE_CHOICE));
return $this->getCacheKey($onlyKeys, Criteria::CRITERIA_TYPE_CHOICE);
}
return $this->getCacheKey($onlyKeys, Criteria::CRITERIA_TYPE_CHOICE);
}
*/
public function getCacheKeyExclude (array $onlyKeys = []) {
// Trace message
*/
public function getCacheKeyExclude (array $onlyKeys = []) {
// Trace message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: onlyKeys()=%d - CALLED!', count($onlyKeys)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: onlyKeys()=%d - CALLED!', count($onlyKeys)));
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CRITERIA: Invoking this->getCacheKey(onlyKeys()=%d,%s) ...', count($onlyKeys),Criteria::CRITERIA_TYPE_EXCLUDE));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: Invoking this->getCacheKey(onlyKeys()=%d,%s) ...', count($onlyKeys),Criteria::CRITERIA_TYPE_EXCLUDE));
return $this->getCacheKey($onlyKeys, Criteria::CRITERIA_TYPE_EXCLUDE);
}
return $this->getCacheKey($onlyKeys, Criteria::CRITERIA_TYPE_EXCLUDE);
}
*/
public final function countChoice () {
// Trace message
*/
public final function countChoice () {
// Trace message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-CRITERIA: CALLED!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-CRITERIA: CALLED!');
return $this->count(Criteria::CRITERIA_TYPE_CHOICE);
}
return $this->count(Criteria::CRITERIA_TYPE_CHOICE);
}
*/
public final function countExclude () {
// Trace message
*/
public final function countExclude () {
// Trace message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-CRITERIA: CALLED!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-CRITERIA: CALLED!');
return $this->count(Criteria::CRITERIA_TYPE_EXCLUDE);
}
return $this->count(Criteria::CRITERIA_TYPE_EXCLUDE);
}
use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
// Import SPL stuff
use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
// Import SPL stuff
+use \BadMethodCallException;
use \InvalidArgumentException;
/**
use \InvalidArgumentException;
/**
*/
public static final function createDataSetCriteria (string $tableName) {
// Validate parameter
*/
public static final function createDataSetCriteria (string $tableName) {
// Validate parameter
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATA-SET-CRITERIA: tableName=%s - CALLED!', $tableName));
if (empty($tableName)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "tableName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
if (empty($tableName)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "tableName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
$criteriaInstance->setTableName($tableName);
// Return the instance
$criteriaInstance->setTableName($tableName);
// Return the instance
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATA-SET-CRITERIA: criteriaInstance=%s - EXIT!', $criteriaInstance->__toString()));
return $criteriaInstance;
}
return $criteriaInstance;
}
* Getter for unique key value
*
* @return $uniqueValue Value of the unique key
* Getter for unique key value
*
* @return $uniqueValue Value of the unique key
+ * @throws BadMethodCallException If no primary and no unique key was found
*/
public final function getUniqueValue () {
// Get primary key(s) first
*/
public final function getUniqueValue () {
// Get primary key(s) first
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('DATA-SET-CRITERIA: CALLED!');
$primaryKey = trim($this->getCriteriaElemnent($this->getPrimaryKey()));
$primaryKeys = $this->getPrimaryKeys();
$primaryKey = trim($this->getCriteriaElemnent($this->getPrimaryKey()));
$primaryKeys = $this->getPrimaryKeys();
- // Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATA-SET-CRITERIA: tableName=' . $this->getTableName() . ',primaryKey=' . $primaryKey . ',primaryKeys()=' . count($primaryKeys));
-
/*
* If this is not set, this could mean a badly written frontend as
* tables should always have a primary key.
*/
/*
* If this is not set, this could mean a badly written frontend as
* tables should always have a primary key.
*/
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('DATA-SET-CRITERIA: this->tableName=%s,primaryKey=%s,primaryKeys()=%d', $this->getTableName(), $primaryKey, count($primaryKeys)));
if (count($primaryKeys) > 0) {
/*
* Init return value, this can be put all together without any
if (count($primaryKeys) > 0) {
/*
* Init return value, this can be put all together without any
$return = '';
// Combination set, so get all
$return = '';
// Combination set, so get all
- foreach ($primaryKeys as $primaryKey) {
+ foreach ($primaryKeys as $primaryKeyPart) {
- $return .= trim($this->getCriteriaElemnent($primaryKey));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('DATA-SET-CRITERIA: primaryKeyPart=%s', $primaryKeyPart));
+ $return .= trim($this->getCriteriaElemnent($primaryKeyPart));
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATA-SET-CRITERIA: tableName=' . $this->getTableName() . ',return=' . $return . ' - EXIT!');
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATA-SET-CRITERIA: return=%s - EXIT!', $return));
return $return;
} elseif (!empty($primaryKey)) {
// Return primary key
return $return;
} elseif (!empty($primaryKey)) {
// Return primary key
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATA-SET-CRITERIA: primaryKey=%s - EXIT!', $primaryKey));
return $primaryKey;
} else {
return $primaryKey;
} else {
- // @TODO Issue a warning
- self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATA-SET-CRITERIA: Primary key not set for table ' . $this->getTableName() . ', please fix your table. Falling back to unique key ...');
+ // Issue a warning
+ self::createDebugInstance(__CLASS__, __LINE__)->warningMessage('DATA-SET-CRITERIA: Primary key not set for table ' . $this->getTableName() . ', please fix your table. Falling back to unique key ...');
// Get unique key
$uniqueKey = trim($this->getCriteriaElemnent($this->getUniqueKey()));
// Get unique key
$uniqueKey = trim($this->getCriteriaElemnent($this->getUniqueKey()));
- // Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATA-SET-CRITERIA: tableName=' . $this->getTableName() . ',uniqueKey=' . $uniqueKey);
-
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('DATA-SET-CRITERIA: uniqueKey=%s', $uniqueKey));
if (empty($uniqueKey)) {
// Bad news, nothing is "unique" by design for this table
if (empty($uniqueKey)) {
// Bad news, nothing is "unique" by design for this table
- ApplicationEntryPoint::exitApplication('Table ' . $this->getTableName() . ' has both no primary and unique key, but ' . __METHOD__ . ' was called. Please fix your table.');
- } else {
- // Return unique key
- return $uniqueKey;
+ throw new BadMethodCallException(sprintf('Table %s has both no primary and unique key, but %s was called. Please fix your table.', $this->getTableName(), __METHOD__), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
+
+ // Return unique key
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATA-SET-CRITERIA: uniqueKey=%s - EXIT!', $uniqueKey));
+ return $uniqueKey;
*/
public final function getPrimaryKey () {
// Get primary key by default
*/
public final function getPrimaryKey () {
// Get primary key by default
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('DATA-SET-CRITERIA: CALLED!');
$primaryKey = $this->primaryKey;
$primaryKey = $this->primaryKey;
+ // Is it still empty?
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('DATA-SET-CRITERIA: primaryKey=%s', $primaryKey));
if (empty($primaryKey)) {
// Get uniqueKey
$primaryKey = $this->getUniqueKey();
}
// Return it
if (empty($primaryKey)) {
// Get uniqueKey
$primaryKey = $this->getUniqueKey();
}
// Return it
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('DATA-SET-CRITERIA: primaryKey=%s - EXIT!', $primaryKey));