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;
    }
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;
    }
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 ; }
Sanitize a value according to the order of actions in a sanitize array.

@param mixed $varValue
@param null|array $sanitizations
@return mixed|string
Sanitize a value according to the order of actions in a sanitize array .