commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
MeConfig.php
1 <?php
2 
3 declare(strict_types=1);
4 
5 namespace Commercetools\Client;
6 
8 use Commercetools\Client\ClientCredentialsConfig as BaseClientCredentialsConfig;
9 
10 class MeConfig extends BaseAuthConfig implements BaseClientCredentialsConfig
11 {
12  public const ANON_AUTH_URI = 'https://auth.europe-west1.gcp.commercetools.com/oauth/{projectKey}/anonymous/token';
13  public const REFRESH_AUTH_URI = 'https://auth.europe-west1.gcp.commercetools.com/oauth/token';
14 
15  public const GRANT_TYPE = 'client_credentials';
16 
18  private $credentials;
19 
21  private $anonUri;
22 
24  private $refreshUri;
25 
26  public function __construct(
27  string $projectKey,
28  ClientCredentials $credentials,
29  array $clientOptions = [],
30  string $anonUri = null,
31  string $refreshUri = null,
32  string $authUri = self::AUTH_URI
33  ) {
34  parent::__construct($clientOptions, $authUri);
35  $anonUri = $anonUri ?? self::ANON_AUTH_URI;
36  $anonUri = str_replace('{projectKey}', $projectKey, $anonUri);
37  $this->anonUri = $anonUri;
38  $this->refreshUri = $refreshUri ?? self::REFRESH_AUTH_URI;
39  $this->credentials = $credentials;
40  }
41 
42  public function getCredentials(): ClientCredentials
43  {
44  return $this->credentials;
45  }
46 
47  public function getAnonUri(): string
48  {
49  return $this->anonUri;
50  }
51 
52  public function getRefreshUri(): string
53  {
54  return $this->refreshUri;
55  }
56 }
__construct(string $projectKey, ClientCredentials $credentials, array $clientOptions=[], string $anonUri=null, string $refreshUri=null, string $authUri=self::AUTH_URI)
Definition: MeConfig.php:26