Вход Регистрация
Файл: vendor/lusitanian/oauth/src/OAuth/Common/Service/AbstractService.php
Строк: 90
<?php
namespace OAuthCommonService;

use 
OAuthCommonConsumerCredentials;
use 
OAuthCommonHttpClientClientInterface;
use 
OAuthCommonHttpUriUri;
use 
OAuthCommonHttpUriUriInterface;
use 
OAuthCommonExceptionException;
use 
OAuthCommonStorageTokenStorageInterface;

/**
 * Abstract OAuth service, version-agnostic
 */
abstract class AbstractService implements ServiceInterface
{
    
/** @var OAuthCommonConsumerCredentials */
    
protected $credentials;

    
/** @var OAuthCommonHttpClientClientInterface */
    
protected $httpClient;

    
/** @var OAuthCommonStorageTokenStorageInterface */
    
protected $storage;

    
/**
     * @param OAuthCommonConsumerCredentials $credentials
     * @param OAuthCommonHttpClientClientInterface $httpClient
     * @param OAuthCommonStorageTokenStorageInterface $storage
     */
    
public function __construct(Credentials $credentialsClientInterface $httpClientTokenStorageInterface $storage)
    {
        
$this->credentials $credentials;
        
$this->httpClient   $httpClient;
        
$this->storage $storage;
    }

    protected function 
determineRequestUriFromPath($pathUriInterface $baseApiUri null)
    {
        if( 
$path instanceof UriInterface ) {
            
$uri $path;
        } elseif( 
stripos($path'http://') === || stripos($path'https://') === ) {
            
$uri = new Uri($path);
        } else {
            if( 
null === $baseApiUri ) {
                throw new 
Exception('An absolute URI must be passed to ServiceInterface::request as no baseApiUri is set.');
            }

            
$uri = clone $baseApiUri;
            if( 
false !== strpos($path'?') ) {
                
$parts explode('?'$path2);
                
$path $parts[0];
                
$query $parts[1];
                
$uri->setQuery($query);
            }

            if( 
$path[0] === '/' ) {
                
$path substr($path1);
            }

            
$uri->setPath($uri->getPath() . $path);
        }

        return 
$uri;
    }

    
/**
    * Accessor to the storage adapter to be able to retrieve tokens
    *
    */
    
public function getStorage() {
        return 
$this->storage;
    }

    
/**
     * @return string
     */
    
public function service() 
    {
        
// get class name without backslashes
        
$classname get_class($this);
        return 
preg_replace('/^.*\\/'''$classname);
    }
}
Онлайн: 1
Реклама