Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 7... Línea 7...
7
use OpenSSLCertificate;
7
use OpenSSLCertificate;
8
use TypeError;
8
use TypeError;
Línea 9... Línea 9...
9
 
9
 
10
class Key
10
class Key
11
{
-
 
12
    /** @var string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate */
-
 
13
    private $keyMaterial;
-
 
14
    /** @var string */
-
 
15
    private $algorithm;
-
 
16
 
11
{
17
    /**
12
    /**
18
     * @param string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate $keyMaterial
13
     * @param string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate $keyMaterial
19
     * @param string $algorithm
14
     * @param string $algorithm
20
     */
15
     */
21
    public function __construct(
16
    public function __construct(
22
        $keyMaterial,
17
        private $keyMaterial,
23
        string $algorithm
18
        private string $algorithm
24
    ) {
19
    ) {
25
        if (
20
        if (
26
            !\is_string($keyMaterial)
21
            !\is_string($keyMaterial)
27
            && !$keyMaterial instanceof OpenSSLAsymmetricKey
22
            && !$keyMaterial instanceof OpenSSLAsymmetricKey
Línea 36... Línea 31...
36
        }
31
        }
Línea 37... Línea 32...
37
 
32
 
38
        if (empty($algorithm)) {
33
        if (empty($algorithm)) {
39
            throw new InvalidArgumentException('Algorithm must not be empty');
34
            throw new InvalidArgumentException('Algorithm must not be empty');
40
        }
-
 
41
 
-
 
42
        // TODO: Remove in PHP 8.0 in favor of class constructor property promotion
-
 
43
        $this->keyMaterial = $keyMaterial;
-
 
44
        $this->algorithm = $algorithm;
35
        }
Línea 45... Línea 36...
45
    }
36
    }
46
 
37
 
47
    /**
38
    /**