-
Notifications
You must be signed in to change notification settings - Fork 151
Expand file tree
/
Copy pathCloudConfigTrait.php
More file actions
87 lines (81 loc) · 2.09 KB
/
CloudConfigTrait.php
File metadata and controls
87 lines (81 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
/**
* This file is part of the Cloudinary PHP package.
*
* (c) Cloudinary
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cloudinary\Configuration;
/**
* Trait CloudConfigTrait
*
*/
trait CloudConfigTrait
{
/**
* Sets the name of your Cloudinary cloud.
*
* @param string $cloudName The name of your Cloudinary cloud.
* Used to build the public URL for all your media assets.
*
* @return $this
*
* @api
*/
public function cloudName(string $cloudName): static
{
return $this->setCloudConfig(CloudConfig::CLOUD_NAME, $cloudName);
}
/**
* Sets the OAuth2.0 token.
*
* @param ?string $oauthToken Used instead of API key and API secret
*
* @return $this
*
* @api
*/
public function oauthToken(?string $oauthToken): static
{
return $this->setCloudConfig(CloudConfig::OAUTH_TOKEN, $oauthToken);
}
/**
* Sets the signature algorithm.
*
* @param string $signatureAlgorithm The algorithm to use. (Can be SHA1 or SHA256).
*
* @return $this
*
* @api
*/
public function signatureAlgorithm(string $signatureAlgorithm): static
{
return $this->setCloudConfig(CloudConfig::SIGNATURE_ALGORITHM, $signatureAlgorithm);
}
/**
* Sets the signature version.
*
* @param int $signatureVersion The signature version to use. (Can be 1 or 2).
*
* @return $this
*
* @api
*/
public function signatureVersion(int $signatureVersion): static
{
return $this->setCloudConfig(CloudConfig::SIGNATURE_VERSION, $signatureVersion);
}
/**
* Sets the Cloud configuration key with the specified value.
*
* @param string $configKey The configuration key.
* @param mixed $configValue THe configuration value.
*
* @return $this
*
* @internal
*/
abstract public function setCloudConfig(string $configKey, mixed $configValue): static;
}