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