<commit_before><?php
/* This class is part of the XP framework
 *
 * $Id$ 
 */
    
    
//  uses();
  
  define('SOAPNATIVE',  'webservices.soap.native.NativeSoapClient');
  define('SOAPXP',      'webservices.soap.xp.XPSoapClient');

                    
  /**
   * (Insert class' description here)
   *
   * @ext      extension
   * @see      reference
   * @purpose  purpose
   */
  class SoapDriver extends Object {
    public
      $drivers    = array(),
      $usedriver  = SOAPXP;
      
    protected static
      $instance   = NULL;
      
    /**
     * (Insert method's description here)
     *
     * @param   
     * @return  
     */
    public function __construct() {
      $this->drivers[]= 'webservices.soap.xp.XpSoapClient';
      if (extension_loaded('soap')) {
        $this->drivers[]= 'webservices.soap.native.NativeSoapClient';
      }
    }
          
    /**
     * (Insert method's description here)
     *
     * @param   
     * @return  
     */
    public static function getInstance() {
      if (NULL === self::$instance) {
        self::$instance= new self();
      }
    }
    
    /**
     * (Insert method's description here)
     *
     * @param   
     * @return  
     */
    public function availableDrivers() {
      return $this->drivers;
    }
    
    /**
     * (Insert method's description here)
     *
     * @param   
     * @return  
     */
    public function driverAvailable($driver) {
      // TBI
    }

    /**
     * (Insert method's description here)
     *
     * @param   
     * @return  
     */
    public function fromWsdl($endpoint, $uri) {
      return XPClass::forName(SOAPNATIVE)->newInstance($endpoint, $uri, TRUE);
    }

    /**
     * (Insert method's description here)
     *
     * @param   
     * @return  
     */
    public function fromEndpoint($endpoint, $uri) {
    
      // use the XP SoapClient if ext-soap is not loaded or 
      // SOAPXP is the selected driver. 
      if (!extension_loaded('soap') || $usedriver = SOAPXP) {
        return XPClass::forName(SOAPXP)->newInstance($endpoint, $uri);
      } else {
        return XPClass::forName(SOAPNATIVE)->newInstance($endpoint, $uri, FALSE);
      }
    }

    
    /**
     * (Insert method's description here)
     *
     * @param   
     * @return  
     */
    public function instanciate($preferredOrder= array()) {
      // TBI
    }
    
    /**
     * (Insert method's description here)
     *
     * @param   
     * @return  
     */
    public static function forName($url, $uri) {
      return new NativeSoapClient($url, $uri);
    }
  }
?>
<commit_msg>- Added a method to change the driver<commit_after><?php
/* This class is part of the XP framework
 *
 * $Id$ 
 */
    
    
//  uses();
  
  define('SOAPNATIVE',  'webservices.soap.native.NativeSoapClient');
  define('SOAPXP',      'webservices.soap.xp.XPSoapClient');

                    
  /**
   * (Insert class' description here)
   *
   * @ext      extension
   * @see      reference
   * @purpose  purpose
   */
  class SoapDriver extends Object {
    public
      $drivers    = array(),
      $usedriver  = SOAPXP;
      
    protected static
      $instance   = NULL;
      
    /**
     * (Insert method's description here)
     *
     * @param   
     * @return  
     */
    public function __construct() {
      $this->drivers[]= 'webservices.soap.xp.XpSoapClient';
      if (extension_loaded('soap')) {
        $this->drivers[]= 'webservices.soap.native.NativeSoapClient';
      }
    }
          
    /**
     * (Insert method's description here)
     *
     * @param   
     * @return  
     */
    public static function getInstance() {
      if (NULL === self::$instance) {
        self::$instance= new self();
      }
    }
    
    /**
     * (Insert method's description here)
     *
     * @param   
     * @return  
     */
    public function availableDrivers() {
      return $this->drivers;
    }
    
    /**
     * (Insert method's description here)
     *
     * @param   
     * @return  
     */
    public function driverAvailable($driver) {
      // TBI
    }

    /**
     * (Insert method's description here)
     *
     * @param   
     * @return  
     */
    public function selectDriver($driver) {
      if ($usedriver == SOAPXP || $usedriver == SOAPNATIVE) {
        $usedriver = $driver;
      }
    }

    /**
     * (Insert method's description here)
     *
     * @param   
     * @return  
     */
    public function fromWsdl($endpoint, $uri) {
      return XPClass::forName(SOAPNATIVE)->newInstance($endpoint, $uri, TRUE);
    }

    /**
     * (Insert method's description here)
     *
     * @param   
     * @return  
     */
    public function fromEndpoint($endpoint, $uri) {
    
      // use the XP SoapClient if ext-soap is not loaded or 
      // SOAPXP is the selected driver. 
      if (!extension_loaded('soap') || $usedriver = SOAPXP) {
        return XPClass::forName(SOAPXP)->newInstance($endpoint, $uri);
      } else {
        return XPClass::forName(SOAPNATIVE)->newInstance($endpoint, $uri, FALSE);
      }
    }

    
    /**
     * (Insert method's description here)
     *
     * @param   
     * @return  
     */
    public function instanciate($preferredOrder= array()) {
      // TBI
    }
    
    /**
     * (Insert method's description here)
     *
     * @param   
     * @return  
     */
    public static function forName($url, $uri) {
      return new NativeSoapClient($url, $uri);
    }
  }
?>

{'fraction_non_alphanumeric': 0.13467153284671532, 'fraction_numerical': 0.0, 'mean_word_length': 1.7515060240963856, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '416877', 'n_tokens_mistral': 1756, 'n_tokens_neox': 1677, 'n_words': 357}