original_string: public function getSourceInstance($type, $name, array $parameters, array $globalParameters = array())
      {
          // The source object variable
          $sourceObj = null;
  
          // Getting SourceConfig object for an Imap Source object
          $sourceConfig = $this->getSourceConfig($name, $type, $parameters, $globalParameters);
  
          // Creating a Source object with the given source config object
          if ($sourceConfig instanceof SourceConfig ) {
              // Creating a Source object instance according to the given type
              switch ($type) {
                  case SourceConfig::SOURCE_TYPE_IMAP:
                      // Initializing an Imap Source object
                      $sourceObj = new Imap();
                      break;
                  case SourceConfig::SOURCE_TYPE_POP:
                      // Initializing a Pop Source object
                      $sourceObj = new Pop();
                      break;
                  default:
                      throw new Exception\BadSourceConfigConfigurationException(
                          sprintf(
                              "Unrecognized Parser Source type '%s'. Accepted values are: '%s'",
                              $type,
                              SourceConfig::SOURCE_TYPE_IMAP
                          )
                      );
              }
  
              // Setting the source config to the new source object
              if ($sourceObj instanceof SourceInterface) {
                  $sourceObj->setConfig($sourceConfig);
              } else {
                  throw new Exception\BadSourceConfigConfigurationException(
                      sprintf(
                          "Unexpected object type: expected 'Msl\ResourceProxy\Source\SourceInterface' for type '%s' but got '%s'.",
                          $type,
                          get_class($sourceObj)
                      )
                  );
              }
          } else {
              throw new Exception\BadSourceConfigConfigurationException(
                  sprintf(
                      "Unexpected object type: expected 'Msl\ResourceProxy\Source\SourceConfig' for type '%s' but got '%s'.",
                      $type,
                      get_class($sourceConfig)
                  )
              );
          }
  
          // Returning result
          return $sourceObj;
      }
code: public function getSourceInstance($type, $name, array $parameters, array $globalParameters = array())
      {
          // The source object variable
          $sourceObj = null;
  
          // Getting SourceConfig object for an Imap Source object
          $sourceConfig = $this->getSourceConfig($name, $type, $parameters, $globalParameters);
  
          // Creating a Source object with the given source config object
          if ($sourceConfig instanceof SourceConfig ) {
              // Creating a Source object instance according to the given type
              switch ($type) {
                  case SourceConfig::SOURCE_TYPE_IMAP:
                      // Initializing an Imap Source object
                      $sourceObj = new Imap();
                      break;
                  case SourceConfig::SOURCE_TYPE_POP:
                      // Initializing a Pop Source object
                      $sourceObj = new Pop();
                      break;
                  default:
                      throw new Exception\BadSourceConfigConfigurationException(
                          sprintf(
                              "Unrecognized Parser Source type '%s'. Accepted values are: '%s'",
                              $type,
                              SourceConfig::SOURCE_TYPE_IMAP
                          )
                      );
              }
  
              // Setting the source config to the new source object
              if ($sourceObj instanceof SourceInterface) {
                  $sourceObj->setConfig($sourceConfig);
              } else {
                  throw new Exception\BadSourceConfigConfigurationException(
                      sprintf(
                          "Unexpected object type: expected 'Msl\ResourceProxy\Source\SourceInterface' for type '%s' but got '%s'.",
                          $type,
                          get_class($sourceObj)
                      )
                  );
              }
          } else {
              throw new Exception\BadSourceConfigConfigurationException(
                  sprintf(
                      "Unexpected object type: expected 'Msl\ResourceProxy\Source\SourceConfig' for type '%s' but got '%s'.",
                      $type,
                      get_class($sourceConfig)
                  )
              );
          }
  
          // Returning result
          return $sourceObj;
      }
code_tokens: public function getSourceInstance ( $ type , $ name , array $ parameters , array $ globalParameters = array ( ) ) { // The source object variable $ sourceObj = null ; // Getting SourceConfig object for an Imap Source object $ sourceConfig = $ this -> getSourceConfig ( $ name , $ type , $ parameters , $ globalParameters ) ; // Creating a Source object with the given source config object if ( $ sourceConfig instanceof SourceConfig ) { // Creating a Source object instance according to the given type switch ( $ type ) { case SourceConfig :: SOURCE_TYPE_IMAP : // Initializing an Imap Source object $ sourceObj = new Imap ( ) ; break ; case SourceConfig :: SOURCE_TYPE_POP : // Initializing a Pop Source object $ sourceObj = new Pop ( ) ; break ; default : throw new Exception \ BadSourceConfigConfigurationException ( sprintf ( "Unrecognized Parser Source type '%s'. Accepted values are: '%s'" , $ type , SourceConfig :: SOURCE_TYPE_IMAP ) ) ; } // Setting the source config to the new source object if ( $ sourceObj instanceof SourceInterface ) { $ sourceObj -> setConfig ( $ sourceConfig ) ; } else { throw new Exception \ BadSourceConfigConfigurationException ( sprintf ( "Unexpected object type: expected 'Msl\ResourceProxy\Source\SourceInterface' for type '%s' but got '%s'." , $ type , get_class ( $ sourceObj ) ) ) ; } } else { throw new Exception \ BadSourceConfigConfigurationException ( sprintf ( "Unexpected object type: expected 'Msl\ResourceProxy\Source\SourceConfig' for type '%s' but got '%s'." , $ type , get_class ( $ sourceConfig ) ) ) ; } // Returning result return $ sourceObj ; }
docstring: Gets a Source instance according to the type.
  
  @param string $type       type of the required Source instance (e.g. 'imap')
  @param string $name       name of the returned Source instance (e.g. 'imap.main.account')
  @param array  $parameters configuration parameters to initialize a Source instance
  @param array $globalParameters   Global configuration array: if required parameters are not specified in the parameters array, then we check if they are defined in this array
  
  @return \Msl\ResourceProxy\Source\SourceInterface
  
  @throws \Msl\ResourceProxy\Exception\BadSourceConfigConfigurationException
docstring_tokens: Gets a Source instance according to the type .