private function validateIndexNameAndValue($indexName, $value)
{
if (!is_scalar($value)) {
throw new \InvalidArgumentException("Invalid index type for '" . $indexName . "'index. Expecting '*_int' for an integer index, or '*_bin' for a string index.");
}
$isIntIndex = SecondaryIndex::isIntIndex($indexName);
$isStringIndex = SecondaryIndex::isStringIndex($indexName);
if (!$isIntIndex && !$isStringIndex) {
throw new \InvalidArgumentException("Invalid index type for '" . $indexName . "'index. Expecting '*_int' for an integer index, or '*_bin' for a string index.");
}
if ($isIntIndex && !is_int($value)) {
throw new \InvalidArgumentException("Invalid type for '" . $indexName . "'index. Expecting 'integer', value was '" . gettype($value) . "''");
}
if ($isStringIndex && !is_string($value)) {
throw new \InvalidArgumentException("Invalid type for '" . $indexName . "'index. Expecting 'string', value was '" . gettype($value) . "''");
}
}