PluginProbe
Media Cloud Sync / 1.4.1
Media Cloud Sync v1.4.1
1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 All 35 releases
← All changes | includes/sdk/google/firebase/php-jwt/src/Key.php +7 -14 1.2.31.4.1 View file →
@@ -1,7 +1,7 @@
1 1 <?php
2 2
3 -namespace Dudlewebs\WPMCS\Firebase\JWT;
3 +namespace Dudlewebs\WPMCS\GCP\Firebase\JWT;
4 4
5 5 use InvalidArgumentException;
6 6 use OpenSSLAsymmetricKey;
7 7 use OpenSSLCertificate;
@@ -7,20 +7,16 @@
7 7 use OpenSSLCertificate;
8 8 use TypeError;
9 9 class Key
10 10 {
11 - /** @var string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate */
12 - private $keyMaterial;
13 - /** @var string */
14 - private $algorithm;
15 11 /**
16 - * @param string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate $keyMaterial
12 + * @param string|OpenSSLAsymmetricKey|OpenSSLCertificate $keyMaterial
17 13 * @param string $algorithm
18 14 */
19 - public function __construct($keyMaterial, string $algorithm)
15 + public function __construct(#[\SensitiveParameter] private $keyMaterial, private string $algorithm)
20 16 {
21 - if (!\is_string($keyMaterial) && !$keyMaterial instanceof OpenSSLAsymmetricKey && !$keyMaterial instanceof OpenSSLCertificate && !\is_resource($keyMaterial)) {
22 - throw new TypeError('Key material must be a string, resource, or OpenSSLAsymmetricKey');
17 + if (!\is_string($keyMaterial) && !$keyMaterial instanceof OpenSSLAsymmetricKey && !$keyMaterial instanceof OpenSSLCertificate) {
18 + throw new TypeError('Key material must be a string, OpenSSLCertificate, or OpenSSLAsymmetricKey');
23 19 }
24 20 if (empty($keyMaterial)) {
25 21 throw new InvalidArgumentException('Key material must not be empty');
26 22 }
@@ -26,11 +22,8 @@
26 22 }
27 23 if (empty($algorithm)) {
28 24 throw new InvalidArgumentException('Algorithm must not be empty');
29 25 }
30 - // TODO: Remove in PHP 8.0 in favor of class constructor property promotion
31 - $this->keyMaterial = $keyMaterial;
32 - $this->algorithm = $algorithm;
33 26 }
34 27 /**
35 28 * Return the algorithm valid for this key
36 29 *
@@ -35,14 +28,14 @@
35 28 * Return the algorithm valid for this key
36 29 *
37 30 * @return string
38 31 */
39 - public function getAlgorithm(): string
32 + public function getAlgorithm() : string
40 33 {
41 34 return $this->algorithm;
42 35 }
43 36 /**
44 - * @return string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate
37 + * @return string|OpenSSLAsymmetricKey|OpenSSLCertificate
45 38 */
46 39 public function getKeyMaterial()
47 40 {
48 41 return $this->keyMaterial;