original_string: protected function sanitize($varValue, $sanitizations)
      {
          if (is_array($sanitizations)) {
              foreach ($sanitizations as $value) {
                  try {
                      if (is_string($value)) {
                          switch ($value) {
                              case "trim":
                                  $varValue = trim($varValue);
  
                                  break;
                              case "clear":
                                  $varValue = "";
  
                                  break;
                          }
                      } elseif (is_callable($value)) {
                          $varValue = $value($varValue);
                      }
                  } catch (\Exception $ex) {
                      //*** Sanitisation failed. Continue silently.
                  }
              }
          }
  
          return $varValue;
      }
code: protected function sanitize($varValue, $sanitizations)
      {
          if (is_array($sanitizations)) {
              foreach ($sanitizations as $value) {
                  try {
                      if (is_string($value)) {
                          switch ($value) {
                              case "trim":
                                  $varValue = trim($varValue);
  
                                  break;
                              case "clear":
                                  $varValue = "";
  
                                  break;
                          }
                      } elseif (is_callable($value)) {
                          $varValue = $value($varValue);
                      }
                  } catch (\Exception $ex) {
                      //*** Sanitisation failed. Continue silently.
                  }
              }
          }
  
          return $varValue;
      }
code_tokens: protected function sanitize ( $ varValue , $ sanitizations ) { if ( is_array ( $ sanitizations ) ) { foreach ( $ sanitizations as $ value ) { try { if ( is_string ( $ value ) ) { switch ( $ value ) { case "trim" : $ varValue = trim ( $ varValue ) ; break ; case "clear" : $ varValue = "" ; break ; } } elseif ( is_callable ( $ value ) ) { $ varValue = $ value ( $ varValue ) ; } } catch ( \ Exception $ ex ) { //*** Sanitisation failed. Continue silently. } } } return $ varValue ; }
docstring: Sanitize a value according to the order of actions in a sanitize array.
  
  @param mixed $varValue
  @param null|array $sanitizations
  @return mixed|string
docstring_tokens: Sanitize a value according to the order of actions in a sanitize array .