1 | <?php |
||
18 | class Signer implements SignerInterface, LoggerAwareInterface |
||
19 | { |
||
20 | use LoggerAwareTrait; |
||
21 | |||
22 | |||
23 | /**************************************************************************/ |
||
24 | // PROPERTIES |
||
25 | |||
26 | /** @var string */ |
||
27 | private $self_key; |
||
28 | |||
29 | /** @var string */ |
||
30 | private $client_id; |
||
31 | |||
32 | /** @var string */ |
||
33 | private $client_secret; |
||
34 | |||
35 | /** @var string */ |
||
36 | private $hash_algo; |
||
37 | |||
38 | /** @var \Skyzyx\Signer\Signer */ |
||
39 | private $signer; |
||
40 | |||
41 | |||
42 | /**************************************************************************/ |
||
43 | // PUBLIC METHODS |
||
44 | |||
45 | /** |
||
46 | * Constructs a new instance of this class. |
||
47 | * |
||
48 | * @param string $client_id A string which is the public portion of the keypair identifying the client party. |
||
49 | * The pairing of the public and private portions of the keypair should only be known |
||
50 | * to the client party and the signing party. |
||
51 | * @param string $client_secret A string which is the private portion of the keypair identifying the client party. |
||
52 | * The pairing of the public and private portions of the keypair should only be known |
||
53 | * to the client party and the signing party. |
||
54 | * @see http://php.net/hash_algos |
||
55 | */ |
||
56 | 7 | public function __construct($client_id, $client_secret) |
|
70 | |||
71 | /** |
||
72 | * {@inheritdoc} |
||
73 | */ |
||
74 | 1 | public function getSelfKey() |
|
79 | |||
80 | /** |
||
81 | * {@inheritdoc} |
||
82 | */ |
||
83 | 4 | public function getClientId() |
|
88 | |||
89 | /** |
||
90 | * {@inheritdoc} |
||
91 | */ |
||
92 | 4 | public function getClientSecret() |
|
97 | |||
98 | /** |
||
99 | * {@inheritdoc} |
||
100 | */ |
||
101 | 3 | public function sign(array $payload) |
|
110 | |||
111 | /** |
||
112 | * Signs and generates the query string URL parameters to use when making a request. |
||
113 | * |
||
114 | * If the `client_secret` key is provided, then it will be automatically excluded from the result. |
||
115 | * |
||
116 | * @param array $payload The data to generate a signature for. |
||
117 | * @return string The query string parameters to append to the end of a URL. |
||
118 | */ |
||
119 | 2 | public function generateQueryStringParams(array $payload) |
|
135 | } |
||
136 |