/**
  * This must support the concept of a hypothetical hostname, not the actual hostname
  *
  * @param PostmanTransport $transport        	
  * @param unknown $hostname        	
  * @return PostmanGoogleOAuthScribe|PostmanMicrosoftOAuthScribe|PostmanYahooOAuthScribe|PostmanNonOAuthScribe
  */
 static function createScribe($hostname, PostmanTransport $transport = null)
 {
     if ($transport->isServiceProviderGoogle($hostname)) {
         return new PostmanGoogleOAuthScribe();
     } else {
         if ($transport->isServiceProviderMicrosoft($hostname)) {
             return new PostmanMicrosoftOAuthScribe();
         } else {
             if ($transport->isServiceProviderYahoo($hostname)) {
                 return new PostmanYahooOAuthScribe();
             } else {
                 return new PostmanNonOAuthScribe($hostname);
             }
         }
     }
 }
 public function createConfig(PostmanTransport $transport)
 {
     // retrieve the hostname and port form the transport
     $hostname = $transport->getHostname();
     $port = $transport->getHostPort();
     // the sender email is needed for the OAuth2 Bearer token
     $senderEmail = PostmanOptions::getInstance()->getEnvelopeSender();
     assert(!empty($senderEmail));
     // the vendor is required for Yahoo's OAuth2 implementation
     $vendor = $this->createVendorString($hostname);
     // create the OAuth2 SMTP Authentication string
     $initClientRequestEncoded = $this->createAuthenticationString($senderEmail, PostmanOAuthToken::getInstance()->getAccessToken(), $vendor);
     // create the Configuration structure for Zend_Mail
     $config = $this->createConfiguration($hostname, $port, $transport->getSecurityType(), $transport->getAuthenticationType(), $initClientRequestEncoded);
     // return the Configuration structure
     return $config;
 }
 /**
  * A short-hand way of showing the complete delivery method
  *
  * @param PostmanTransport $transport        	
  * @return string
  */
 public function getPublicTransportUri(PostmanTransport $transport)
 {
     $options = PostmanOptions::getInstance();
     $transportName = $transport->getSlug();
     $auth = $transport->getAuthenticationType($options);
     $security = $transport->getSecurityType($options);
     $host = $transport->getHostname($options);
     $port = $transport->getHostPort($options);
     return sprintf('%s:%s:%s://%s:%s', $transportName, $security, $auth, $host, $port);
 }