return $success; } private function getCounterForPeriod($quotaName) { /** * @var Counter $counter */ $counter = new Counter(); // Validation based on (Drupal-based UI) code from e3_ui_policy_add_context_submit_validate if (!empty($_POST[$quotaName]['warning']) || !empty($_POST[$quotaName]['threshold'])) { $counter->setAction($_POST[$quotaName]['action']); // $counter->setStatus($_POST[$quotaName]['status']); $threshold = !empty($_POST[$quotaName]['threshold']) ? trim($_POST[$quotaName]['threshold']) : "0"; $warning = !empty($_POST[$quotaName]['warning']) ? trim($_POST[$quotaName]['warning']) : "0"; $counter->setThreshold($threshold); $counter->setWarning($warning); if (strlen($threshold) > 0 && strlen($warning) == 0) { $counter->setWarning(0.0); } } return $counter; } private static function validateCounterForPeriod($counter, $quotaName, &$validationErrors) { /** * @var Counter $counter */