PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.9.16
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.9.16
1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 1.10.0 1.9.17 1.9.15 1.9.16 1.9.14 All 163 releases
woocommerce-pos / vendor_prefixed / firebase / php-jwt / src / Key.php

Key.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.9.16, at vendor_prefixed/firebase/php-jwt/src/Key.php

51 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WCPOS\Vendor\Firebase\JWT;
4
5 use InvalidArgumentException;
6 use OpenSSLAsymmetricKey;
7 use OpenSSLCertificate;
8 use TypeError;
9 class Key
10 {
11 /** @var string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate */
12 private $keyMaterial;
13 /** @var string */
14 private $algorithm;
15 /**
16 * @param string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate $keyMaterial
17 * @param string $algorithm
18 */
19 public function __construct($keyMaterial, string $algorithm)
20 {
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');
23 }
24 if (empty($keyMaterial)) {
25 throw new InvalidArgumentException('Key material must not be empty');
26 }
27 if (empty($algorithm)) {
28 throw new InvalidArgumentException('Algorithm must not be empty');
29 }
30 // TODO: Remove in PHP 8.0 in favor of class constructor property promotion
31 $this->keyMaterial = $keyMaterial;
32 $this->algorithm = $algorithm;
33 }
34 /**
35 * Return the algorithm valid for this key
36 *
37 * @return string
38 */
39 public function getAlgorithm() : string
40 {
41 return $this->algorithm;
42 }
43 /**
44 * @return string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate
45 */
46 public function getKeyMaterial()
47 {
48 return $this->keyMaterial;
49 }
50 }
51