/** * @param $key * @return bool */ protected function evalKey($key) { if (!is_long($key)) { return false; } SplitApp::logger()->info('---> Evaluating LESS_THAN_OR_EQUAL_TO'); if (isset($this->unaryNumericMatcherData['value'])) { $logMsg = '---> KEY: ' . $key; $logMsg .= PHP_EOL . '---> VAL: ' . $this->unaryNumericMatcherData['value']; $logMsg .= PHP_EOL . '---> ATR: ' . $this->attribute; SplitApp::logger()->info($logMsg); if (isset($this->unaryNumericMatcherData['dataType']) && DataTypeEnum::isValid($this->unaryNumericMatcherData['dataType'])) { if (DataTypeEnum::DATETIME == $this->unaryNumericMatcherData['dataType']) { $phpTimestamp = DateTime::millisecondToPHPTimestamp($this->unaryNumericMatcherData['value']); return DateTime::zeroOutSeconds($key) <= DateTime::zeroOutSeconds($phpTimestamp); } } return $key <= $this->unaryNumericMatcherData['value']; } return false; }
/** * @param $key * @return bool */ protected function evalKey($key) { if (!is_long($key)) { return false; } SplitApp::logger()->info('---> Evaluating BETWEEN'); if (isset($this->betweenMatcherData['start']) && isset($this->betweenMatcherData['end'])) { $logMsg = '---> KEY: ' . $key; $logMsg .= PHP_EOL . '---> START: ' . $this->betweenMatcherData['start']; $logMsg .= PHP_EOL . '---> END: ' . $this->betweenMatcherData['end']; $logMsg .= PHP_EOL . '---> ATR: ' . $this->attribute; SplitApp::logger()->info($logMsg); if (isset($this->betweenMatcherData['dataType']) && DataTypeEnum::isValid($this->betweenMatcherData['dataType'])) { if (DataTypeEnum::DATETIME == $this->betweenMatcherData['dataType']) { $phpTimestampStart = DateTime::millisecondToPHPTimestamp($this->betweenMatcherData['start']); $phpTimestampEnd = DateTime::millisecondToPHPTimestamp($this->betweenMatcherData['end']); $normalizedKey = DateTime::zeroOutSeconds($key); return DateTime::zeroOutSeconds($phpTimestampStart) <= $normalizedKey && $normalizedKey <= DateTime::zeroOutSeconds($phpTimestampEnd); } } return $this->betweenMatcherData['start'] <= $key && $key <= $this->betweenMatcherData['end']; } return false; }