|
@@ -15,11 +15,11 @@ class Signature |
|
@@ -15,11 +15,11 @@ class Signature |
|
15
|
$this->item = $item;
|
15
|
$this->item = $item;
|
|
16
|
}
|
16
|
}
|
|
17
|
|
17
|
|
|
18
|
- public static function make(array $items): string
|
18
|
+ public static function make(array $items, string $secret): string
|
|
19
|
{
|
19
|
{
|
|
20
|
$signature = new self($items);
|
20
|
$signature = new self($items);
|
|
21
|
|
21
|
|
|
22
|
- return $signature->toString();
|
22
|
+ return $signature->toString($secret);
|
|
23
|
}
|
23
|
}
|
|
24
|
|
24
|
|
|
25
|
protected function sortByASCII()
|
25
|
protected function sortByASCII()
|
|
@@ -58,15 +58,17 @@ class Signature |
|
@@ -58,15 +58,17 @@ class Signature |
|
58
|
}
|
58
|
}
|
|
59
|
|
59
|
|
|
60
|
/**
|
60
|
/**
|
|
|
|
61
|
+ * @param string $secret
|
|
|
|
62
|
+ *
|
|
61
|
* @return string
|
63
|
* @return string
|
|
62
|
*/
|
64
|
*/
|
|
63
|
- protected function toString(): string
|
65
|
+ protected function toString(string $secret): string
|
|
64
|
{
|
66
|
{
|
|
65
|
$this->sortByASCII();
|
67
|
$this->sortByASCII();
|
|
66
|
|
68
|
|
|
67
|
$string = $this->map($this->item, function ($k, $v) {
|
69
|
$string = $this->map($this->item, function ($k, $v) {
|
|
68
|
- return !($v === '' || $v === null || $k === 'service');
|
|
|
|
69
|
- });
|
70
|
+ return !($v === '' || $v === null);
|
|
|
|
71
|
+ }) . '&key=' . $secret;
|
|
70
|
|
72
|
|
|
71
|
return self::encode($string);
|
73
|
return self::encode($string);
|
|
72
|
}
|
74
|
}
|