Sanitizer.php
<?php
namespace Sanitizer;
class Sanitizer {
public function set($inputs,$types){
$sanitizer = $this;
$output = [];
foreach($inputs as $key=>$value){
$output[] = $this->input($key,$value,$types[$key]);
}
return $output;
}
public function number($input){
if (is_numeric($input)){
return $input;
} else {
$number = preg_replace('/[^0-9]/','',$input);
if (substr($input,0,1)==='-')$number = '-'.$number;
return $number;
}
}
public function input($key,$value,$type){
switch($type){
case "phone":
//return $value;
break;
}
}
}
?>