title: Mixins, call_to_user_func not finding the function
body: <p>So I have a class which is designed to "mix" other classes in, via what i call a "bridge" class. So you have your sample classes for example:</p>
  
  <pre><code>class A{
      public function __construct(){}
  
      public function hello_a(){ echo "hello A"; }
  }
  
  class B{
      public function __construct(){}
  
      public function hello_b(){ echo "hello B"; }
  }
  </code></pre>
  
  <p>You might also have a single class called C - which needs to inherit from both A and B, but since PHP doesn't have multiple inheritance we have the following:</p>
  
  <pre><code>class C extends Bridge{
      public function __construct(){
          parent::__construct();
      }
  
      public function hello_C(){ 
          $this-&gt;hello_a(); // Freaks out*
      }
  }
  
  class Bridge extends AisisCore_Loader_Mixins{
      public function construct(){
          parent::construct();
  
          $this-&gt;setup(array(
              'A' =&gt; array(),
              'B' =&gt; array()
          ));
      }
  }
  </code></pre>
  
  <p>And now finally we have our mix-in class which allows all of this to work. <strong>Note:</strong> this code assumes you have a auto loader using the pear naming standards to load classes for you.</p>
  
  <pre><code>class AisisCore_Loader_Mixins {
  
      private $_classes;
  
      private $_class_objects = array();
  
      private $_methods = array();
  
      public function __construct(){
          $this-&gt;init();
      }
  
      public function init(){}
  
      public function setup($class){
          if(!is_array($class)){
              throw new AisisCore_Loader_LoaderException('Object passed in must be of type $class_name=&gt;$params.');
          }
  
          $this-&gt;_classes = $class;
          $this-&gt;get_class_objects();
          $this-&gt;get_methods();    
      }
  
      public function get_class_objects(){
          foreach($this-&gt;_classes as $class_name=&gt;$params){
              $object = new ReflectionClass($class_name);
              $this-&gt;_class_objects[] = $object-&gt;newInstanceArgs($params);
          }
      }
  
      public function get_methods(){
  
          foreach($this-&gt;_class_objects as $class_object){
              $this-&gt;_methods[] = get_class_methods($class_object);
          }
  
          return $this-&gt;_methods;
      }
  
      public function __call($name, $param = null){
          foreach($this-&gt;_methods as $key=&gt;$methods){
              foreach($methods as $method){
                  if($name === $method){
                      return $this-&gt;isParam($method, $param);
                  }
              }
          }
  
          throw new AisisCore_Loader_LoaderException("Method: " .$name. 
                              " does not exist or it's access is not public");
      }
  
      private function isParam($method, $param){
          if($param != null){
              call_user_func($method, $param);
          }else{
              call_user_func($method);
          }        
      }
  }
  </code></pre>
  
  <p>You can see in class <code>C</code> how the class above is used, we simply just call <code>hello_a</code>. All is well up to this point until it tries <code>call_user_func()</code> and freaks out saying:</p>
  
  <pre><code>Warning: call_user_func() expects parameter 1 to be a valid callback, function 'hello_a' not found or invalid function name 
  </code></pre>
  
  <p>Is there a particular reason it cannot find this? the classes are loaded, the methods are stored in the array, it obviously found the method in the array of methods, the method is public. whats going on?</p>