I am currently stamped and i can't see where I have done it wrong. I have a static function request() below:
private static function request(){
if($_SERVER['REQUEST_METHOD']=='GET'){
$data = RunData::get('cmd');
}
which calls a static function get() which in turn calls a private function clean() which uses variables set in the class constructor loading an Injected class Sanitize
class RunData {
public static $sanitize;
public function __construct( Sanitize $sanitize ){
self::$sanitize = $sanitize;
}
private static function clean($variable_array){
if(is_array($variable_array)){
$filters = array('string' => 'sanitize_string');
return self::$sanitize->filter($variable_array, $filters);
}
}
public static function get($variable){
if(self::clean($_GET)){
return $_GET[$variable];
}
}
}
but when I run I get this error.
Fatal error: Call to a member function filter() on a non-object
This filter function is loaded from the Sanitize Class which is injected into the constructor.
What possibly have I missed??? The constructor doesn't seem to be running
Thanks