Merge pull request #23698 from seamuslee001/fix_price_set_entity_since
[civicrm-core.git] / CRM / Utils / Request.php
index 643646c2ed6265a5f6ef1fb88444cee947c6099c..0ab38f48986203118d9812f24f37001a955a5627 100644 (file)
@@ -43,7 +43,7 @@ class CRM_Utils_Request {
    */
   public static function id() {
     if (!isset(\Civi::$statics[__CLASS__]['id'])) {
-      \Civi::$statics[__CLASS__]['id'] = uniqid() . CRM_Utils_String::createRandom(CRM_Utils_String::ALPHANUMERIC, 4);
+      \Civi::$statics[__CLASS__]['id'] = uniqid() . CRM_Utils_String::createRandom(4, CRM_Utils_String::ALPHANUMERIC);
     }
     return \Civi::$statics[__CLASS__]['id'];
   }
@@ -63,15 +63,13 @@ class CRM_Utils_Request {
    *   Default value of the variable if not present.
    * @param string $method
    *   Where to look for the variable - 'GET', 'POST' or 'REQUEST'.
-   * @param bool $isThrowException
-   *   Should a an exception be thrown rather than a fatal.
    *
    * @return mixed
    *   The value of the variable
    *
    * @throws \CRM_Core_Exception
    */
-  public static function retrieve($name, $type, &$store = NULL, $abort = FALSE, $default = NULL, $method = 'REQUEST', $isThrowException = TRUE) {
+  public static function retrieve($name, $type, &$store = NULL, $abort = FALSE, $default = NULL, $method = 'REQUEST') {
 
     $value = NULL;
     switch ($method) {
@@ -97,10 +95,7 @@ class CRM_Utils_Request {
     }
 
     if (!isset($value) && $abort) {
-      if ($isThrowException) {
-        throw new CRM_Core_Exception(ts("Could not find valid value for %1", [1 => $name]));
-      }
-      CRM_Core_Error::fatal(ts("Could not find valid value for %1", [1 => $name]));
+      throw new CRM_Core_Exception(ts('Could not find valid value for %1', [1 => $name]));
     }
 
     if (!isset($value) && $default) {
@@ -108,7 +103,7 @@ class CRM_Utils_Request {
     }
 
     // minor hack for action
-    if ($name == 'action') {
+    if ($name === 'action') {
       if (!is_numeric($value) && is_string($value)) {
         $value = CRM_Core_Action::resolve($value);
       }