original_string: public function invokeMethod($method, $params)
      {
          // for named parameters, convert from object to assoc array
          if (is_object($params)) {
              $array = array();
              foreach ($params as $key => $val) {
                  $array[$key] = $val;
              }
              $params = array($array);
          }
          // for no params, pass in empty array
          if ($params === null) {
              $params = array();
          }
          $reflection = new \ReflectionMethod($this->exposed_instance, $method);
          
          // only allow calls to public functions
          if (!$reflection->isPublic()) {
              throw new Serverside\Exception("Called method is not publically accessible.");
          }
  
          // enforce correct number of arguments
          $num_required_params = $reflection->getNumberOfRequiredParameters();
          if ($num_required_params > count($params)) {
              throw new Serverside\Exception("Too few parameters passed.");
          }
          
          return $reflection->invokeArgs($this->exposed_instance, $params);
      }
code: public function invokeMethod($method, $params)
      {
          // for named parameters, convert from object to assoc array
          if (is_object($params)) {
              $array = array();
              foreach ($params as $key => $val) {
                  $array[$key] = $val;
              }
              $params = array($array);
          }
          // for no params, pass in empty array
          if ($params === null) {
              $params = array();
          }
          $reflection = new \ReflectionMethod($this->exposed_instance, $method);
          
          // only allow calls to public functions
          if (!$reflection->isPublic()) {
              throw new Serverside\Exception("Called method is not publically accessible.");
          }
  
          // enforce correct number of arguments
          $num_required_params = $reflection->getNumberOfRequiredParameters();
          if ($num_required_params > count($params)) {
              throw new Serverside\Exception("Too few parameters passed.");
          }
          
          return $reflection->invokeArgs($this->exposed_instance, $params);
      }
code_tokens: public function invokeMethod ( $ method , $ params ) { // for named parameters, convert from object to assoc array if ( is_object ( $ params ) ) { $ array = array ( ) ; foreach ( $ params as $ key => $ val ) { $ array [ $ key ] = $ val ; } $ params = array ( $ array ) ; } // for no params, pass in empty array if ( $ params === null ) { $ params = array ( ) ; } $ reflection = new \ ReflectionMethod ( $ this -> exposed_instance , $ method ) ; // only allow calls to public functions if ( ! $ reflection -> isPublic ( ) ) { throw new Serverside \ Exception ( "Called method is not publically accessible." ) ; } // enforce correct number of arguments $ num_required_params = $ reflection -> getNumberOfRequiredParameters ( ) ; if ( $ num_required_params > count ( $ params ) ) { throw new Serverside \ Exception ( "Too few parameters passed." ) ; } return $ reflection -> invokeArgs ( $ this -> exposed_instance , $ params ) ; }
docstring: attempt to invoke the method with params
docstring_tokens: attempt to invoke the method with params