PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.6 28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 All 130 releases
← All changes | vendor_prefixed/guzzlehttp/guzzle/src/Handler/TlsVersion.php +0 -74 28.2 → trunk View file →
@@ -1,74 +1,0 @@
1 -<?php
2 -
3 -namespace YoastSEO_Vendor\GuzzleHttp\Handler;
4 -
5 -/**
6 - * @internal
7 - */
8 -final class TlsVersion
9 -{
10 - /**
11 - * @param mixed $value
12 - */
13 - public static function ordinal(string $option, $value) : int
14 - {
15 - if ($value === \STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT) {
16 - return 10;
17 - }
18 - if ($value === \STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT) {
19 - return 11;
20 - }
21 - if ($value === \STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT) {
22 - return 12;
23 - }
24 - if (\defined('STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT') && $value === \STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT) {
25 - return 13;
26 - }
27 - throw new \InvalidArgumentException(\sprintf('Invalid %s request option: unknown version provided', $option));
28 - }
29 - /**
30 - * @param mixed $min
31 - * @param mixed $max
32 - */
33 - public static function assertRange($min, $max) : void
34 - {
35 - if ($min === null || $max === null) {
36 - return;
37 - }
38 - if (self::ordinal('crypto_method_max', $max) < self::ordinal('crypto_method', $min)) {
39 - throw new \InvalidArgumentException('Invalid crypto_method_max request option: maximum TLS version must be greater than or equal to crypto_method');
40 - }
41 - }
42 - /**
43 - * @param mixed $value
44 - */
45 - public static function streamProtocolVersion(string $option, $value) : int
46 - {
47 - if ($value === \STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT) {
48 - return self::requireStreamProto('STREAM_CRYPTO_PROTO_TLSv1_0', $option);
49 - }
50 - if ($value === \STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT) {
51 - return self::requireStreamProto('STREAM_CRYPTO_PROTO_TLSv1_1', $option);
52 - }
53 - if ($value === \STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT) {
54 - return self::requireStreamProto('STREAM_CRYPTO_PROTO_TLSv1_2', $option);
55 - }
56 - if (\defined('STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT') && $value === \STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT) {
57 - return self::requireStreamProto('STREAM_CRYPTO_PROTO_TLSv1_3', $option);
58 - }
59 - throw new \InvalidArgumentException(\sprintf('Invalid %s request option: unknown version provided', $option));
60 - }
61 - /**
62 - * Resolves a STREAM_CRYPTO_PROTO_* constant. The ssl.max_proto_version
63 - * context option and these constants were added in PHP 7.3.0 (TLS 1.3 in
64 - * 7.4.0); on older runtimes the option cannot be honored, so reject loudly.
65 - */
66 - private static function requireStreamProto(string $constant, string $option) : int
67 - {
68 - if (\defined($constant)) {
69 - /** @var int */
70 - return \constant($constant);
71 - }
72 - throw new \InvalidArgumentException(\sprintf('Invalid %s request option: maximum TLS version control is not supported by your version of PHP', $option));
73 - }
74 -}