Completed
Pull Request — master (#421)
by Maxence
03:59
created
lib/Vendor/GuzzleHttp/BodySummarizerInterface.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@
 block discarded – undo
5 5
 use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\MessageInterface;
6 6
 interface BodySummarizerInterface
7 7
 {
8
-    /**
9
-     * Returns a summarized message body.
10
-     */
11
-    public function summarize(MessageInterface $message) : ?string;
8
+	/**
9
+	 * Returns a summarized message body.
10
+	 */
11
+	public function summarize(MessageInterface $message) : ?string;
12 12
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,7 @@
 block discarded – undo
3 3
 namespace OCA\FullTextSearch_Elasticsearch\Vendor\GuzzleHttp;
4 4
 
5 5
 use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\MessageInterface;
6
-interface BodySummarizerInterface
7
-{
6
+interface BodySummarizerInterface {
8 7
     /**
9 8
      * Returns a summarized message body.
10 9
      */
Please login to merge, or discard this patch.
lib/Vendor/GuzzleHttp/Psr7/Header.php 3 patches
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -5,113 +5,113 @@
 block discarded – undo
5 5
 
6 6
 final class Header
7 7
 {
8
-    /**
9
-     * Parse an array of header values containing ";" separated data into an
10
-     * array of associative arrays representing the header key value pair data
11
-     * of the header. When a parameter does not contain a value, but just
12
-     * contains a key, this function will inject a key with a '' string value.
13
-     *
14
-     * @param string|array $header Header to parse into components.
15
-     */
16
-    public static function parse($header) : array
17
-    {
18
-        static $trimmed = "\"'  \n\t\r";
19
-        $params = $matches = [];
20
-        foreach ((array) $header as $value) {
21
-            foreach (self::splitList($value) as $val) {
22
-                $part = [];
23
-                foreach (\preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) ?: [] as $kvp) {
24
-                    if (\preg_match_all('/<[^>]+>|[^=]+/', $kvp, $matches)) {
25
-                        $m = $matches[0];
26
-                        if (isset($m[1])) {
27
-                            $part[\trim($m[0], $trimmed)] = \trim($m[1], $trimmed);
28
-                        } else {
29
-                            $part[] = \trim($m[0], $trimmed);
30
-                        }
31
-                    }
32
-                }
33
-                if ($part) {
34
-                    $params[] = $part;
35
-                }
36
-            }
37
-        }
38
-        return $params;
39
-    }
40
-    /**
41
-     * Converts an array of header values that may contain comma separated
42
-     * headers into an array of headers with no comma separated values.
43
-     *
44
-     * @param string|array $header Header to normalize.
45
-     *
46
-     * @deprecated Use self::splitList() instead.
47
-     */
48
-    public static function normalize($header) : array
49
-    {
50
-        $result = [];
51
-        foreach ((array) $header as $value) {
52
-            foreach (self::splitList($value) as $parsed) {
53
-                $result[] = $parsed;
54
-            }
55
-        }
56
-        return $result;
57
-    }
58
-    /**
59
-     * Splits a HTTP header defined to contain a comma-separated list into
60
-     * each individual value. Empty values will be removed.
61
-     *
62
-     * Example headers include 'accept', 'cache-control' and 'if-none-match'.
63
-     *
64
-     * This method must not be used to parse headers that are not defined as
65
-     * a list, such as 'user-agent' or 'set-cookie'.
66
-     *
67
-     * @param string|string[] $values Header value as returned by MessageInterface::getHeader()
68
-     *
69
-     * @return string[]
70
-     */
71
-    public static function splitList($values) : array
72
-    {
73
-        if (!\is_array($values)) {
74
-            $values = [$values];
75
-        }
76
-        $result = [];
77
-        foreach ($values as $value) {
78
-            if (!\is_string($value)) {
79
-                throw new \TypeError('$header must either be a string or an array containing strings.');
80
-            }
81
-            $v = '';
82
-            $isQuoted = \false;
83
-            $isEscaped = \false;
84
-            for ($i = 0, $max = \strlen($value); $i < $max; ++$i) {
85
-                if ($isEscaped) {
86
-                    $v .= $value[$i];
87
-                    $isEscaped = \false;
88
-                    continue;
89
-                }
90
-                if (!$isQuoted && $value[$i] === ',') {
91
-                    $v = \trim($v);
92
-                    if ($v !== '') {
93
-                        $result[] = $v;
94
-                    }
95
-                    $v = '';
96
-                    continue;
97
-                }
98
-                if ($isQuoted && $value[$i] === '\\') {
99
-                    $isEscaped = \true;
100
-                    $v .= $value[$i];
101
-                    continue;
102
-                }
103
-                if ($value[$i] === '"') {
104
-                    $isQuoted = !$isQuoted;
105
-                    $v .= $value[$i];
106
-                    continue;
107
-                }
108
-                $v .= $value[$i];
109
-            }
110
-            $v = \trim($v);
111
-            if ($v !== '') {
112
-                $result[] = $v;
113
-            }
114
-        }
115
-        return $result;
116
-    }
8
+	/**
9
+	 * Parse an array of header values containing ";" separated data into an
10
+	 * array of associative arrays representing the header key value pair data
11
+	 * of the header. When a parameter does not contain a value, but just
12
+	 * contains a key, this function will inject a key with a '' string value.
13
+	 *
14
+	 * @param string|array $header Header to parse into components.
15
+	 */
16
+	public static function parse($header) : array
17
+	{
18
+		static $trimmed = "\"'  \n\t\r";
19
+		$params = $matches = [];
20
+		foreach ((array) $header as $value) {
21
+			foreach (self::splitList($value) as $val) {
22
+				$part = [];
23
+				foreach (\preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) ?: [] as $kvp) {
24
+					if (\preg_match_all('/<[^>]+>|[^=]+/', $kvp, $matches)) {
25
+						$m = $matches[0];
26
+						if (isset($m[1])) {
27
+							$part[\trim($m[0], $trimmed)] = \trim($m[1], $trimmed);
28
+						} else {
29
+							$part[] = \trim($m[0], $trimmed);
30
+						}
31
+					}
32
+				}
33
+				if ($part) {
34
+					$params[] = $part;
35
+				}
36
+			}
37
+		}
38
+		return $params;
39
+	}
40
+	/**
41
+	 * Converts an array of header values that may contain comma separated
42
+	 * headers into an array of headers with no comma separated values.
43
+	 *
44
+	 * @param string|array $header Header to normalize.
45
+	 *
46
+	 * @deprecated Use self::splitList() instead.
47
+	 */
48
+	public static function normalize($header) : array
49
+	{
50
+		$result = [];
51
+		foreach ((array) $header as $value) {
52
+			foreach (self::splitList($value) as $parsed) {
53
+				$result[] = $parsed;
54
+			}
55
+		}
56
+		return $result;
57
+	}
58
+	/**
59
+	 * Splits a HTTP header defined to contain a comma-separated list into
60
+	 * each individual value. Empty values will be removed.
61
+	 *
62
+	 * Example headers include 'accept', 'cache-control' and 'if-none-match'.
63
+	 *
64
+	 * This method must not be used to parse headers that are not defined as
65
+	 * a list, such as 'user-agent' or 'set-cookie'.
66
+	 *
67
+	 * @param string|string[] $values Header value as returned by MessageInterface::getHeader()
68
+	 *
69
+	 * @return string[]
70
+	 */
71
+	public static function splitList($values) : array
72
+	{
73
+		if (!\is_array($values)) {
74
+			$values = [$values];
75
+		}
76
+		$result = [];
77
+		foreach ($values as $value) {
78
+			if (!\is_string($value)) {
79
+				throw new \TypeError('$header must either be a string or an array containing strings.');
80
+			}
81
+			$v = '';
82
+			$isQuoted = \false;
83
+			$isEscaped = \false;
84
+			for ($i = 0, $max = \strlen($value); $i < $max; ++$i) {
85
+				if ($isEscaped) {
86
+					$v .= $value[$i];
87
+					$isEscaped = \false;
88
+					continue;
89
+				}
90
+				if (!$isQuoted && $value[$i] === ',') {
91
+					$v = \trim($v);
92
+					if ($v !== '') {
93
+						$result[] = $v;
94
+					}
95
+					$v = '';
96
+					continue;
97
+				}
98
+				if ($isQuoted && $value[$i] === '\\') {
99
+					$isEscaped = \true;
100
+					$v .= $value[$i];
101
+					continue;
102
+				}
103
+				if ($value[$i] === '"') {
104
+					$isQuoted = !$isQuoted;
105
+					$v .= $value[$i];
106
+					continue;
107
+				}
108
+				$v .= $value[$i];
109
+			}
110
+			$v = \trim($v);
111
+			if ($v !== '') {
112
+				$result[] = $v;
113
+			}
114
+		}
115
+		return $result;
116
+	}
117 117
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare (strict_types=1);
3
+declare(strict_types=1);
4 4
 namespace OCA\FullTextSearch_Elasticsearch\Vendor\GuzzleHttp\Psr7;
5 5
 
6 6
 final class Header
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     {
18 18
         static $trimmed = "\"'  \n\t\r";
19 19
         $params = $matches = [];
20
-        foreach ((array) $header as $value) {
20
+        foreach ((array)$header as $value) {
21 21
             foreach (self::splitList($value) as $val) {
22 22
                 $part = [];
23 23
                 foreach (\preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) ?: [] as $kvp) {
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     public static function normalize($header) : array
49 49
     {
50 50
         $result = [];
51
-        foreach ((array) $header as $value) {
51
+        foreach ((array)$header as $value) {
52 52
             foreach (self::splitList($value) as $parsed) {
53 53
                 $result[] = $parsed;
54 54
             }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,7 @@
 block discarded – undo
3 3
 declare (strict_types=1);
4 4
 namespace OCA\FullTextSearch_Elasticsearch\Vendor\GuzzleHttp\Psr7;
5 5
 
6
-final class Header
7
-{
6
+final class Header {
8 7
     /**
9 8
      * Parse an array of header values containing ";" separated data into an
10 9
      * array of associative arrays representing the header key value pair data
Please login to merge, or discard this patch.
lib/Vendor/GuzzleHttp/Psr7/HttpFactory.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare (strict_types=1);
3
+declare(strict_types=1);
4 4
 namespace OCA\FullTextSearch_Elasticsearch\Vendor\GuzzleHttp\Psr7;
5 5
 
6 6
 use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\RequestFactoryInterface;
Please login to merge, or discard this patch.
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -23,54 +23,54 @@
 block discarded – undo
23 23
  */
24 24
 final class HttpFactory implements RequestFactoryInterface, ResponseFactoryInterface, ServerRequestFactoryInterface, StreamFactoryInterface, UploadedFileFactoryInterface, UriFactoryInterface
25 25
 {
26
-    public function createUploadedFile(StreamInterface $stream, ?int $size = null, int $error = \UPLOAD_ERR_OK, ?string $clientFilename = null, ?string $clientMediaType = null) : UploadedFileInterface
27
-    {
28
-        if ($size === null) {
29
-            $size = $stream->getSize();
30
-        }
31
-        return new UploadedFile($stream, $size, $error, $clientFilename, $clientMediaType);
32
-    }
33
-    public function createStream(string $content = '') : StreamInterface
34
-    {
35
-        return Utils::streamFor($content);
36
-    }
37
-    public function createStreamFromFile(string $file, string $mode = 'r') : StreamInterface
38
-    {
39
-        try {
40
-            $resource = Utils::tryFopen($file, $mode);
41
-        } catch (\RuntimeException $e) {
42
-            if ('' === $mode || \false === \in_array($mode[0], ['r', 'w', 'a', 'x', 'c'], \true)) {
43
-                throw new \InvalidArgumentException(\sprintf('Invalid file opening mode "%s"', $mode), 0, $e);
44
-            }
45
-            throw $e;
46
-        }
47
-        return Utils::streamFor($resource);
48
-    }
49
-    public function createStreamFromResource($resource) : StreamInterface
50
-    {
51
-        return Utils::streamFor($resource);
52
-    }
53
-    public function createServerRequest(string $method, $uri, array $serverParams = []) : ServerRequestInterface
54
-    {
55
-        if (empty($method)) {
56
-            if (!empty($serverParams['REQUEST_METHOD'])) {
57
-                $method = $serverParams['REQUEST_METHOD'];
58
-            } else {
59
-                throw new \InvalidArgumentException('Cannot determine HTTP method');
60
-            }
61
-        }
62
-        return new ServerRequest($method, $uri, [], null, '1.1', $serverParams);
63
-    }
64
-    public function createResponse(int $code = 200, string $reasonPhrase = '') : ResponseInterface
65
-    {
66
-        return new Response($code, [], null, '1.1', $reasonPhrase);
67
-    }
68
-    public function createRequest(string $method, $uri) : RequestInterface
69
-    {
70
-        return new Request($method, $uri);
71
-    }
72
-    public function createUri(string $uri = '') : UriInterface
73
-    {
74
-        return new Uri($uri);
75
-    }
26
+	public function createUploadedFile(StreamInterface $stream, ?int $size = null, int $error = \UPLOAD_ERR_OK, ?string $clientFilename = null, ?string $clientMediaType = null) : UploadedFileInterface
27
+	{
28
+		if ($size === null) {
29
+			$size = $stream->getSize();
30
+		}
31
+		return new UploadedFile($stream, $size, $error, $clientFilename, $clientMediaType);
32
+	}
33
+	public function createStream(string $content = '') : StreamInterface
34
+	{
35
+		return Utils::streamFor($content);
36
+	}
37
+	public function createStreamFromFile(string $file, string $mode = 'r') : StreamInterface
38
+	{
39
+		try {
40
+			$resource = Utils::tryFopen($file, $mode);
41
+		} catch (\RuntimeException $e) {
42
+			if ('' === $mode || \false === \in_array($mode[0], ['r', 'w', 'a', 'x', 'c'], \true)) {
43
+				throw new \InvalidArgumentException(\sprintf('Invalid file opening mode "%s"', $mode), 0, $e);
44
+			}
45
+			throw $e;
46
+		}
47
+		return Utils::streamFor($resource);
48
+	}
49
+	public function createStreamFromResource($resource) : StreamInterface
50
+	{
51
+		return Utils::streamFor($resource);
52
+	}
53
+	public function createServerRequest(string $method, $uri, array $serverParams = []) : ServerRequestInterface
54
+	{
55
+		if (empty($method)) {
56
+			if (!empty($serverParams['REQUEST_METHOD'])) {
57
+				$method = $serverParams['REQUEST_METHOD'];
58
+			} else {
59
+				throw new \InvalidArgumentException('Cannot determine HTTP method');
60
+			}
61
+		}
62
+		return new ServerRequest($method, $uri, [], null, '1.1', $serverParams);
63
+	}
64
+	public function createResponse(int $code = 200, string $reasonPhrase = '') : ResponseInterface
65
+	{
66
+		return new Response($code, [], null, '1.1', $reasonPhrase);
67
+	}
68
+	public function createRequest(string $method, $uri) : RequestInterface
69
+	{
70
+		return new Request($method, $uri);
71
+	}
72
+	public function createUri(string $uri = '') : UriInterface
73
+	{
74
+		return new Uri($uri);
75
+	}
76 76
 }
Please login to merge, or discard this patch.
lib/Vendor/GuzzleHttp/Psr7/PumpStream.php 3 patches
Indentation   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -16,134 +16,134 @@
 block discarded – undo
16 16
  */
17 17
 final class PumpStream implements StreamInterface
18 18
 {
19
-    /** @var callable(int): (string|false|null)|null */
20
-    private $source;
21
-    /** @var int|null */
22
-    private $size;
23
-    /** @var int */
24
-    private $tellPos = 0;
25
-    /** @var array */
26
-    private $metadata;
27
-    /** @var BufferStream */
28
-    private $buffer;
29
-    /**
30
-     * @param callable(int): (string|false|null)  $source  Source of the stream data. The callable MAY
31
-     *                                                     accept an integer argument used to control the
32
-     *                                                     amount of data to return. The callable MUST
33
-     *                                                     return a string when called, or false|null on error
34
-     *                                                     or EOF.
35
-     * @param array{size?: int, metadata?: array} $options Stream options:
36
-     *                                                     - metadata: Hash of metadata to use with stream.
37
-     *                                                     - size: Size of the stream, if known.
38
-     */
39
-    public function __construct(callable $source, array $options = [])
40
-    {
41
-        $this->source = $source;
42
-        $this->size = $options['size'] ?? null;
43
-        $this->metadata = $options['metadata'] ?? [];
44
-        $this->buffer = new BufferStream();
45
-    }
46
-    public function __toString() : string
47
-    {
48
-        try {
49
-            return Utils::copyToString($this);
50
-        } catch (\Throwable $e) {
51
-            if (\PHP_VERSION_ID >= 70400) {
52
-                throw $e;
53
-            }
54
-            \trigger_error(\sprintf('%s::__toString exception: %s', self::class, (string) $e), \E_USER_ERROR);
55
-            return '';
56
-        }
57
-    }
58
-    public function close() : void
59
-    {
60
-        $this->detach();
61
-    }
62
-    public function detach()
63
-    {
64
-        $this->tellPos = 0;
65
-        $this->source = null;
66
-        return null;
67
-    }
68
-    public function getSize() : ?int
69
-    {
70
-        return $this->size;
71
-    }
72
-    public function tell() : int
73
-    {
74
-        return $this->tellPos;
75
-    }
76
-    public function eof() : bool
77
-    {
78
-        return $this->source === null;
79
-    }
80
-    public function isSeekable() : bool
81
-    {
82
-        return \false;
83
-    }
84
-    public function rewind() : void
85
-    {
86
-        $this->seek(0);
87
-    }
88
-    public function seek($offset, $whence = \SEEK_SET) : void
89
-    {
90
-        throw new \RuntimeException('Cannot seek a PumpStream');
91
-    }
92
-    public function isWritable() : bool
93
-    {
94
-        return \false;
95
-    }
96
-    public function write($string) : int
97
-    {
98
-        throw new \RuntimeException('Cannot write to a PumpStream');
99
-    }
100
-    public function isReadable() : bool
101
-    {
102
-        return \true;
103
-    }
104
-    public function read($length) : string
105
-    {
106
-        $data = $this->buffer->read($length);
107
-        $readLen = \strlen($data);
108
-        $this->tellPos += $readLen;
109
-        $remaining = $length - $readLen;
110
-        if ($remaining) {
111
-            $this->pump($remaining);
112
-            $data .= $this->buffer->read($remaining);
113
-            $this->tellPos += \strlen($data) - $readLen;
114
-        }
115
-        return $data;
116
-    }
117
-    public function getContents() : string
118
-    {
119
-        $result = '';
120
-        while (!$this->eof()) {
121
-            $result .= $this->read(1000000);
122
-        }
123
-        return $result;
124
-    }
125
-    /**
126
-     * @return mixed
127
-     */
128
-    public function getMetadata($key = null)
129
-    {
130
-        if (!$key) {
131
-            return $this->metadata;
132
-        }
133
-        return $this->metadata[$key] ?? null;
134
-    }
135
-    private function pump(int $length) : void
136
-    {
137
-        if ($this->source !== null) {
138
-            do {
139
-                $data = ($this->source)($length);
140
-                if ($data === \false || $data === null) {
141
-                    $this->source = null;
142
-                    return;
143
-                }
144
-                $this->buffer->write($data);
145
-                $length -= \strlen($data);
146
-            } while ($length > 0);
147
-        }
148
-    }
19
+	/** @var callable(int): (string|false|null)|null */
20
+	private $source;
21
+	/** @var int|null */
22
+	private $size;
23
+	/** @var int */
24
+	private $tellPos = 0;
25
+	/** @var array */
26
+	private $metadata;
27
+	/** @var BufferStream */
28
+	private $buffer;
29
+	/**
30
+	 * @param callable(int): (string|false|null)  $source  Source of the stream data. The callable MAY
31
+	 *                                                     accept an integer argument used to control the
32
+	 *                                                     amount of data to return. The callable MUST
33
+	 *                                                     return a string when called, or false|null on error
34
+	 *                                                     or EOF.
35
+	 * @param array{size?: int, metadata?: array} $options Stream options:
36
+	 *                                                     - metadata: Hash of metadata to use with stream.
37
+	 *                                                     - size: Size of the stream, if known.
38
+	 */
39
+	public function __construct(callable $source, array $options = [])
40
+	{
41
+		$this->source = $source;
42
+		$this->size = $options['size'] ?? null;
43
+		$this->metadata = $options['metadata'] ?? [];
44
+		$this->buffer = new BufferStream();
45
+	}
46
+	public function __toString() : string
47
+	{
48
+		try {
49
+			return Utils::copyToString($this);
50
+		} catch (\Throwable $e) {
51
+			if (\PHP_VERSION_ID >= 70400) {
52
+				throw $e;
53
+			}
54
+			\trigger_error(\sprintf('%s::__toString exception: %s', self::class, (string) $e), \E_USER_ERROR);
55
+			return '';
56
+		}
57
+	}
58
+	public function close() : void
59
+	{
60
+		$this->detach();
61
+	}
62
+	public function detach()
63
+	{
64
+		$this->tellPos = 0;
65
+		$this->source = null;
66
+		return null;
67
+	}
68
+	public function getSize() : ?int
69
+	{
70
+		return $this->size;
71
+	}
72
+	public function tell() : int
73
+	{
74
+		return $this->tellPos;
75
+	}
76
+	public function eof() : bool
77
+	{
78
+		return $this->source === null;
79
+	}
80
+	public function isSeekable() : bool
81
+	{
82
+		return \false;
83
+	}
84
+	public function rewind() : void
85
+	{
86
+		$this->seek(0);
87
+	}
88
+	public function seek($offset, $whence = \SEEK_SET) : void
89
+	{
90
+		throw new \RuntimeException('Cannot seek a PumpStream');
91
+	}
92
+	public function isWritable() : bool
93
+	{
94
+		return \false;
95
+	}
96
+	public function write($string) : int
97
+	{
98
+		throw new \RuntimeException('Cannot write to a PumpStream');
99
+	}
100
+	public function isReadable() : bool
101
+	{
102
+		return \true;
103
+	}
104
+	public function read($length) : string
105
+	{
106
+		$data = $this->buffer->read($length);
107
+		$readLen = \strlen($data);
108
+		$this->tellPos += $readLen;
109
+		$remaining = $length - $readLen;
110
+		if ($remaining) {
111
+			$this->pump($remaining);
112
+			$data .= $this->buffer->read($remaining);
113
+			$this->tellPos += \strlen($data) - $readLen;
114
+		}
115
+		return $data;
116
+	}
117
+	public function getContents() : string
118
+	{
119
+		$result = '';
120
+		while (!$this->eof()) {
121
+			$result .= $this->read(1000000);
122
+		}
123
+		return $result;
124
+	}
125
+	/**
126
+	 * @return mixed
127
+	 */
128
+	public function getMetadata($key = null)
129
+	{
130
+		if (!$key) {
131
+			return $this->metadata;
132
+		}
133
+		return $this->metadata[$key] ?? null;
134
+	}
135
+	private function pump(int $length) : void
136
+	{
137
+		if ($this->source !== null) {
138
+			do {
139
+				$data = ($this->source)($length);
140
+				if ($data === \false || $data === null) {
141
+					$this->source = null;
142
+					return;
143
+				}
144
+				$this->buffer->write($data);
145
+				$length -= \strlen($data);
146
+			} while ($length > 0);
147
+		}
148
+	}
149 149
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare (strict_types=1);
3
+declare(strict_types=1);
4 4
 namespace OCA\FullTextSearch_Elasticsearch\Vendor\GuzzleHttp\Psr7;
5 5
 
6 6
 use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\StreamInterface;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
             if (\PHP_VERSION_ID >= 70400) {
52 52
                 throw $e;
53 53
             }
54
-            \trigger_error(\sprintf('%s::__toString exception: %s', self::class, (string) $e), \E_USER_ERROR);
54
+            \trigger_error(\sprintf('%s::__toString exception: %s', self::class, (string)$e), \E_USER_ERROR);
55 55
             return '';
56 56
         }
57 57
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,7 @@
 block discarded – undo
14 14
  * the read() function of the PumpStream. The provided callable MUST return
15 15
  * false when there is no more data to read.
16 16
  */
17
-final class PumpStream implements StreamInterface
18
-{
17
+final class PumpStream implements StreamInterface {
19 18
     /** @var callable(int): (string|false|null)|null */
20 19
     private $source;
21 20
     /** @var int|null */
Please login to merge, or discard this patch.
lib/Vendor/GuzzleHttp/Psr7/MultipartStream.php 3 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare (strict_types=1);
3
+declare(strict_types=1);
4 4
 namespace OCA\FullTextSearch_Elasticsearch\Vendor\GuzzleHttp\Psr7;
5 5
 
6 6
 use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\StreamInterface;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         foreach ($headers as $key => $value) {
52 52
             $str .= "{$key}: {$value}\r\n";
53 53
         }
54
-        return "--{$this->boundary}\r\n" . \trim($str) . "\r\n\r\n";
54
+        return "--{$this->boundary}\r\n".\trim($str)."\r\n\r\n";
55 55
     }
56 56
     /**
57 57
      * Create the aggregate stream that will be used to upload the POST data
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         $length = self::getHeader($headers, 'content-length');
105 105
         if (!$length) {
106 106
             if ($length = $stream->getSize()) {
107
-                $headers['Content-Length'] = (string) $length;
107
+                $headers['Content-Length'] = (string)$length;
108 108
             }
109 109
         }
110 110
         // Set a default Content-Type if one was not supplied
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     {
122 122
         $lowercaseHeader = \strtolower($key);
123 123
         foreach ($headers as $k => $v) {
124
-            if (\strtolower((string) $k) === $lowercaseHeader) {
124
+            if (\strtolower((string)$k) === $lowercaseHeader) {
125 125
                 return $v;
126 126
             }
127 127
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,7 @@
 block discarded – undo
8 8
  * Stream that when read returns bytes for a streaming multipart or
9 9
  * multipart/form-data stream.
10 10
  */
11
-final class MultipartStream implements StreamInterface
12
-{
11
+final class MultipartStream implements StreamInterface {
13 12
     use StreamDecoratorTrait;
14 13
     /** @var string */
15 14
     private $boundary;
Please login to merge, or discard this patch.
Indentation   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -10,121 +10,121 @@
 block discarded – undo
10 10
  */
11 11
 final class MultipartStream implements StreamInterface
12 12
 {
13
-    use StreamDecoratorTrait;
14
-    /** @var string */
15
-    private $boundary;
16
-    /** @var StreamInterface */
17
-    private $stream;
18
-    /**
19
-     * @param array  $elements Array of associative arrays, each containing a
20
-     *                         required "name" key mapping to the form field,
21
-     *                         name, a required "contents" key mapping to a
22
-     *                         StreamInterface/resource/string, an optional
23
-     *                         "headers" associative array of custom headers,
24
-     *                         and an optional "filename" key mapping to a
25
-     *                         string to send as the filename in the part.
26
-     * @param string $boundary You can optionally provide a specific boundary
27
-     *
28
-     * @throws \InvalidArgumentException
29
-     */
30
-    public function __construct(array $elements = [], ?string $boundary = null)
31
-    {
32
-        $this->boundary = $boundary ?: \bin2hex(\random_bytes(20));
33
-        $this->stream = $this->createStream($elements);
34
-    }
35
-    public function getBoundary() : string
36
-    {
37
-        return $this->boundary;
38
-    }
39
-    public function isWritable() : bool
40
-    {
41
-        return \false;
42
-    }
43
-    /**
44
-     * Get the headers needed before transferring the content of a POST file
45
-     *
46
-     * @param string[] $headers
47
-     */
48
-    private function getHeaders(array $headers) : string
49
-    {
50
-        $str = '';
51
-        foreach ($headers as $key => $value) {
52
-            $str .= "{$key}: {$value}\r\n";
53
-        }
54
-        return "--{$this->boundary}\r\n" . \trim($str) . "\r\n\r\n";
55
-    }
56
-    /**
57
-     * Create the aggregate stream that will be used to upload the POST data
58
-     */
59
-    protected function createStream(array $elements = []) : StreamInterface
60
-    {
61
-        $stream = new AppendStream();
62
-        foreach ($elements as $element) {
63
-            if (!\is_array($element)) {
64
-                throw new \UnexpectedValueException('An array is expected');
65
-            }
66
-            $this->addElement($stream, $element);
67
-        }
68
-        // Add the trailing boundary with CRLF
69
-        $stream->addStream(Utils::streamFor("--{$this->boundary}--\r\n"));
70
-        return $stream;
71
-    }
72
-    private function addElement(AppendStream $stream, array $element) : void
73
-    {
74
-        foreach (['contents', 'name'] as $key) {
75
-            if (!\array_key_exists($key, $element)) {
76
-                throw new \InvalidArgumentException("A '{$key}' key is required");
77
-            }
78
-        }
79
-        $element['contents'] = Utils::streamFor($element['contents']);
80
-        if (empty($element['filename'])) {
81
-            $uri = $element['contents']->getMetadata('uri');
82
-            if ($uri && \is_string($uri) && \substr($uri, 0, 6) !== 'php://' && \substr($uri, 0, 7) !== 'data://') {
83
-                $element['filename'] = $uri;
84
-            }
85
-        }
86
-        [$body, $headers] = $this->createElement($element['name'], $element['contents'], $element['filename'] ?? null, $element['headers'] ?? []);
87
-        $stream->addStream(Utils::streamFor($this->getHeaders($headers)));
88
-        $stream->addStream($body);
89
-        $stream->addStream(Utils::streamFor("\r\n"));
90
-    }
91
-    /**
92
-     * @param string[] $headers
93
-     *
94
-     * @return array{0: StreamInterface, 1: string[]}
95
-     */
96
-    private function createElement(string $name, StreamInterface $stream, ?string $filename, array $headers) : array
97
-    {
98
-        // Set a default content-disposition header if one was no provided
99
-        $disposition = self::getHeader($headers, 'content-disposition');
100
-        if (!$disposition) {
101
-            $headers['Content-Disposition'] = $filename === '0' || $filename ? \sprintf('form-data; name="%s"; filename="%s"', $name, \basename($filename)) : "form-data; name=\"{$name}\"";
102
-        }
103
-        // Set a default content-length header if one was no provided
104
-        $length = self::getHeader($headers, 'content-length');
105
-        if (!$length) {
106
-            if ($length = $stream->getSize()) {
107
-                $headers['Content-Length'] = (string) $length;
108
-            }
109
-        }
110
-        // Set a default Content-Type if one was not supplied
111
-        $type = self::getHeader($headers, 'content-type');
112
-        if (!$type && ($filename === '0' || $filename)) {
113
-            $headers['Content-Type'] = MimeType::fromFilename($filename) ?? 'application/octet-stream';
114
-        }
115
-        return [$stream, $headers];
116
-    }
117
-    /**
118
-     * @param string[] $headers
119
-     */
120
-    private static function getHeader(array $headers, string $key) : ?string
121
-    {
122
-        $lowercaseHeader = \strtolower($key);
123
-        foreach ($headers as $k => $v) {
124
-            if (\strtolower((string) $k) === $lowercaseHeader) {
125
-                return $v;
126
-            }
127
-        }
128
-        return null;
129
-    }
13
+	use StreamDecoratorTrait;
14
+	/** @var string */
15
+	private $boundary;
16
+	/** @var StreamInterface */
17
+	private $stream;
18
+	/**
19
+	 * @param array  $elements Array of associative arrays, each containing a
20
+	 *                         required "name" key mapping to the form field,
21
+	 *                         name, a required "contents" key mapping to a
22
+	 *                         StreamInterface/resource/string, an optional
23
+	 *                         "headers" associative array of custom headers,
24
+	 *                         and an optional "filename" key mapping to a
25
+	 *                         string to send as the filename in the part.
26
+	 * @param string $boundary You can optionally provide a specific boundary
27
+	 *
28
+	 * @throws \InvalidArgumentException
29
+	 */
30
+	public function __construct(array $elements = [], ?string $boundary = null)
31
+	{
32
+		$this->boundary = $boundary ?: \bin2hex(\random_bytes(20));
33
+		$this->stream = $this->createStream($elements);
34
+	}
35
+	public function getBoundary() : string
36
+	{
37
+		return $this->boundary;
38
+	}
39
+	public function isWritable() : bool
40
+	{
41
+		return \false;
42
+	}
43
+	/**
44
+	 * Get the headers needed before transferring the content of a POST file
45
+	 *
46
+	 * @param string[] $headers
47
+	 */
48
+	private function getHeaders(array $headers) : string
49
+	{
50
+		$str = '';
51
+		foreach ($headers as $key => $value) {
52
+			$str .= "{$key}: {$value}\r\n";
53
+		}
54
+		return "--{$this->boundary}\r\n" . \trim($str) . "\r\n\r\n";
55
+	}
56
+	/**
57
+	 * Create the aggregate stream that will be used to upload the POST data
58
+	 */
59
+	protected function createStream(array $elements = []) : StreamInterface
60
+	{
61
+		$stream = new AppendStream();
62
+		foreach ($elements as $element) {
63
+			if (!\is_array($element)) {
64
+				throw new \UnexpectedValueException('An array is expected');
65
+			}
66
+			$this->addElement($stream, $element);
67
+		}
68
+		// Add the trailing boundary with CRLF
69
+		$stream->addStream(Utils::streamFor("--{$this->boundary}--\r\n"));
70
+		return $stream;
71
+	}
72
+	private function addElement(AppendStream $stream, array $element) : void
73
+	{
74
+		foreach (['contents', 'name'] as $key) {
75
+			if (!\array_key_exists($key, $element)) {
76
+				throw new \InvalidArgumentException("A '{$key}' key is required");
77
+			}
78
+		}
79
+		$element['contents'] = Utils::streamFor($element['contents']);
80
+		if (empty($element['filename'])) {
81
+			$uri = $element['contents']->getMetadata('uri');
82
+			if ($uri && \is_string($uri) && \substr($uri, 0, 6) !== 'php://' && \substr($uri, 0, 7) !== 'data://') {
83
+				$element['filename'] = $uri;
84
+			}
85
+		}
86
+		[$body, $headers] = $this->createElement($element['name'], $element['contents'], $element['filename'] ?? null, $element['headers'] ?? []);
87
+		$stream->addStream(Utils::streamFor($this->getHeaders($headers)));
88
+		$stream->addStream($body);
89
+		$stream->addStream(Utils::streamFor("\r\n"));
90
+	}
91
+	/**
92
+	 * @param string[] $headers
93
+	 *
94
+	 * @return array{0: StreamInterface, 1: string[]}
95
+	 */
96
+	private function createElement(string $name, StreamInterface $stream, ?string $filename, array $headers) : array
97
+	{
98
+		// Set a default content-disposition header if one was no provided
99
+		$disposition = self::getHeader($headers, 'content-disposition');
100
+		if (!$disposition) {
101
+			$headers['Content-Disposition'] = $filename === '0' || $filename ? \sprintf('form-data; name="%s"; filename="%s"', $name, \basename($filename)) : "form-data; name=\"{$name}\"";
102
+		}
103
+		// Set a default content-length header if one was no provided
104
+		$length = self::getHeader($headers, 'content-length');
105
+		if (!$length) {
106
+			if ($length = $stream->getSize()) {
107
+				$headers['Content-Length'] = (string) $length;
108
+			}
109
+		}
110
+		// Set a default Content-Type if one was not supplied
111
+		$type = self::getHeader($headers, 'content-type');
112
+		if (!$type && ($filename === '0' || $filename)) {
113
+			$headers['Content-Type'] = MimeType::fromFilename($filename) ?? 'application/octet-stream';
114
+		}
115
+		return [$stream, $headers];
116
+	}
117
+	/**
118
+	 * @param string[] $headers
119
+	 */
120
+	private static function getHeader(array $headers, string $key) : ?string
121
+	{
122
+		$lowercaseHeader = \strtolower($key);
123
+		foreach ($headers as $k => $v) {
124
+			if (\strtolower((string) $k) === $lowercaseHeader) {
125
+				return $v;
126
+			}
127
+		}
128
+		return null;
129
+	}
130 130
 }
Please login to merge, or discard this patch.
lib/Vendor/GuzzleHttp/Psr7/FnStream.php 3 patches
Indentation   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -13,137 +13,137 @@
 block discarded – undo
13 13
 #[\AllowDynamicProperties]
14 14
 final class FnStream implements StreamInterface
15 15
 {
16
-    private const SLOTS = ['__toString', 'close', 'detach', 'rewind', 'getSize', 'tell', 'eof', 'isSeekable', 'seek', 'isWritable', 'write', 'isReadable', 'read', 'getContents', 'getMetadata'];
17
-    /** @var array<string, callable> */
18
-    private $methods;
19
-    /**
20
-     * @param array<string, callable> $methods Hash of method name to a callable.
21
-     */
22
-    public function __construct(array $methods)
23
-    {
24
-        $this->methods = $methods;
25
-        // Create the functions on the class
26
-        foreach ($methods as $name => $fn) {
27
-            $this->{'_fn_' . $name} = $fn;
28
-        }
29
-    }
30
-    /**
31
-     * Lazily determine which methods are not implemented.
32
-     *
33
-     * @throws \BadMethodCallException
34
-     */
35
-    public function __get(string $name) : void
36
-    {
37
-        throw new \BadMethodCallException(\str_replace('_fn_', '', $name) . '() is not implemented in the FnStream');
38
-    }
39
-    /**
40
-     * The close method is called on the underlying stream only if possible.
41
-     */
42
-    public function __destruct()
43
-    {
44
-        if (isset($this->_fn_close)) {
45
-            ($this->_fn_close)();
46
-        }
47
-    }
48
-    /**
49
-     * An unserialize would allow the __destruct to run when the unserialized value goes out of scope.
50
-     *
51
-     * @throws \LogicException
52
-     */
53
-    public function __wakeup() : void
54
-    {
55
-        throw new \LogicException('FnStream should never be unserialized');
56
-    }
57
-    /**
58
-     * Adds custom functionality to an underlying stream by intercepting
59
-     * specific method calls.
60
-     *
61
-     * @param StreamInterface         $stream  Stream to decorate
62
-     * @param array<string, callable> $methods Hash of method name to a closure
63
-     *
64
-     * @return FnStream
65
-     */
66
-    public static function decorate(StreamInterface $stream, array $methods)
67
-    {
68
-        // If any of the required methods were not provided, then simply
69
-        // proxy to the decorated stream.
70
-        foreach (\array_diff(self::SLOTS, \array_keys($methods)) as $diff) {
71
-            /** @var callable $callable */
72
-            $callable = [$stream, $diff];
73
-            $methods[$diff] = $callable;
74
-        }
75
-        return new self($methods);
76
-    }
77
-    public function __toString() : string
78
-    {
79
-        try {
80
-            /** @var string */
81
-            return ($this->_fn___toString)();
82
-        } catch (\Throwable $e) {
83
-            if (\PHP_VERSION_ID >= 70400) {
84
-                throw $e;
85
-            }
86
-            \trigger_error(\sprintf('%s::__toString exception: %s', self::class, (string) $e), \E_USER_ERROR);
87
-            return '';
88
-        }
89
-    }
90
-    public function close() : void
91
-    {
92
-        ($this->_fn_close)();
93
-    }
94
-    public function detach()
95
-    {
96
-        return ($this->_fn_detach)();
97
-    }
98
-    public function getSize() : ?int
99
-    {
100
-        return ($this->_fn_getSize)();
101
-    }
102
-    public function tell() : int
103
-    {
104
-        return ($this->_fn_tell)();
105
-    }
106
-    public function eof() : bool
107
-    {
108
-        return ($this->_fn_eof)();
109
-    }
110
-    public function isSeekable() : bool
111
-    {
112
-        return ($this->_fn_isSeekable)();
113
-    }
114
-    public function rewind() : void
115
-    {
116
-        ($this->_fn_rewind)();
117
-    }
118
-    public function seek($offset, $whence = \SEEK_SET) : void
119
-    {
120
-        ($this->_fn_seek)($offset, $whence);
121
-    }
122
-    public function isWritable() : bool
123
-    {
124
-        return ($this->_fn_isWritable)();
125
-    }
126
-    public function write($string) : int
127
-    {
128
-        return ($this->_fn_write)($string);
129
-    }
130
-    public function isReadable() : bool
131
-    {
132
-        return ($this->_fn_isReadable)();
133
-    }
134
-    public function read($length) : string
135
-    {
136
-        return ($this->_fn_read)($length);
137
-    }
138
-    public function getContents() : string
139
-    {
140
-        return ($this->_fn_getContents)();
141
-    }
142
-    /**
143
-     * @return mixed
144
-     */
145
-    public function getMetadata($key = null)
146
-    {
147
-        return ($this->_fn_getMetadata)($key);
148
-    }
16
+	private const SLOTS = ['__toString', 'close', 'detach', 'rewind', 'getSize', 'tell', 'eof', 'isSeekable', 'seek', 'isWritable', 'write', 'isReadable', 'read', 'getContents', 'getMetadata'];
17
+	/** @var array<string, callable> */
18
+	private $methods;
19
+	/**
20
+	 * @param array<string, callable> $methods Hash of method name to a callable.
21
+	 */
22
+	public function __construct(array $methods)
23
+	{
24
+		$this->methods = $methods;
25
+		// Create the functions on the class
26
+		foreach ($methods as $name => $fn) {
27
+			$this->{'_fn_' . $name} = $fn;
28
+		}
29
+	}
30
+	/**
31
+	 * Lazily determine which methods are not implemented.
32
+	 *
33
+	 * @throws \BadMethodCallException
34
+	 */
35
+	public function __get(string $name) : void
36
+	{
37
+		throw new \BadMethodCallException(\str_replace('_fn_', '', $name) . '() is not implemented in the FnStream');
38
+	}
39
+	/**
40
+	 * The close method is called on the underlying stream only if possible.
41
+	 */
42
+	public function __destruct()
43
+	{
44
+		if (isset($this->_fn_close)) {
45
+			($this->_fn_close)();
46
+		}
47
+	}
48
+	/**
49
+	 * An unserialize would allow the __destruct to run when the unserialized value goes out of scope.
50
+	 *
51
+	 * @throws \LogicException
52
+	 */
53
+	public function __wakeup() : void
54
+	{
55
+		throw new \LogicException('FnStream should never be unserialized');
56
+	}
57
+	/**
58
+	 * Adds custom functionality to an underlying stream by intercepting
59
+	 * specific method calls.
60
+	 *
61
+	 * @param StreamInterface         $stream  Stream to decorate
62
+	 * @param array<string, callable> $methods Hash of method name to a closure
63
+	 *
64
+	 * @return FnStream
65
+	 */
66
+	public static function decorate(StreamInterface $stream, array $methods)
67
+	{
68
+		// If any of the required methods were not provided, then simply
69
+		// proxy to the decorated stream.
70
+		foreach (\array_diff(self::SLOTS, \array_keys($methods)) as $diff) {
71
+			/** @var callable $callable */
72
+			$callable = [$stream, $diff];
73
+			$methods[$diff] = $callable;
74
+		}
75
+		return new self($methods);
76
+	}
77
+	public function __toString() : string
78
+	{
79
+		try {
80
+			/** @var string */
81
+			return ($this->_fn___toString)();
82
+		} catch (\Throwable $e) {
83
+			if (\PHP_VERSION_ID >= 70400) {
84
+				throw $e;
85
+			}
86
+			\trigger_error(\sprintf('%s::__toString exception: %s', self::class, (string) $e), \E_USER_ERROR);
87
+			return '';
88
+		}
89
+	}
90
+	public function close() : void
91
+	{
92
+		($this->_fn_close)();
93
+	}
94
+	public function detach()
95
+	{
96
+		return ($this->_fn_detach)();
97
+	}
98
+	public function getSize() : ?int
99
+	{
100
+		return ($this->_fn_getSize)();
101
+	}
102
+	public function tell() : int
103
+	{
104
+		return ($this->_fn_tell)();
105
+	}
106
+	public function eof() : bool
107
+	{
108
+		return ($this->_fn_eof)();
109
+	}
110
+	public function isSeekable() : bool
111
+	{
112
+		return ($this->_fn_isSeekable)();
113
+	}
114
+	public function rewind() : void
115
+	{
116
+		($this->_fn_rewind)();
117
+	}
118
+	public function seek($offset, $whence = \SEEK_SET) : void
119
+	{
120
+		($this->_fn_seek)($offset, $whence);
121
+	}
122
+	public function isWritable() : bool
123
+	{
124
+		return ($this->_fn_isWritable)();
125
+	}
126
+	public function write($string) : int
127
+	{
128
+		return ($this->_fn_write)($string);
129
+	}
130
+	public function isReadable() : bool
131
+	{
132
+		return ($this->_fn_isReadable)();
133
+	}
134
+	public function read($length) : string
135
+	{
136
+		return ($this->_fn_read)($length);
137
+	}
138
+	public function getContents() : string
139
+	{
140
+		return ($this->_fn_getContents)();
141
+	}
142
+	/**
143
+	 * @return mixed
144
+	 */
145
+	public function getMetadata($key = null)
146
+	{
147
+		return ($this->_fn_getMetadata)($key);
148
+	}
149 149
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare (strict_types=1);
3
+declare(strict_types=1);
4 4
 namespace OCA\FullTextSearch_Elasticsearch\Vendor\GuzzleHttp\Psr7;
5 5
 
6 6
 use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\StreamInterface;
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
         $this->methods = $methods;
25 25
         // Create the functions on the class
26 26
         foreach ($methods as $name => $fn) {
27
-            $this->{'_fn_' . $name} = $fn;
27
+            $this->{'_fn_'.$name} = $fn;
28 28
         }
29 29
     }
30 30
     /**
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function __get(string $name) : void
36 36
     {
37
-        throw new \BadMethodCallException(\str_replace('_fn_', '', $name) . '() is not implemented in the FnStream');
37
+        throw new \BadMethodCallException(\str_replace('_fn_', '', $name).'() is not implemented in the FnStream');
38 38
     }
39 39
     /**
40 40
      * The close method is called on the underlying stream only if possible.
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
             if (\PHP_VERSION_ID >= 70400) {
84 84
                 throw $e;
85 85
             }
86
-            \trigger_error(\sprintf('%s::__toString exception: %s', self::class, (string) $e), \E_USER_ERROR);
86
+            \trigger_error(\sprintf('%s::__toString exception: %s', self::class, (string)$e), \E_USER_ERROR);
87 87
             return '';
88 88
         }
89 89
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,7 @@
 block discarded – undo
11 11
  * to create a concrete class for a simple extension point.
12 12
  */
13 13
 #[\AllowDynamicProperties]
14
-final class FnStream implements StreamInterface
15
-{
14
+final class FnStream implements StreamInterface {
16 15
     private const SLOTS = ['__toString', 'close', 'detach', 'rewind', 'getSize', 'tell', 'eof', 'isSeekable', 'seek', 'isWritable', 'write', 'isReadable', 'read', 'getContents', 'getMetadata'];
17 16
     /** @var array<string, callable> */
18 17
     private $methods;
Please login to merge, or discard this patch.
lib/Vendor/GuzzleHttp/Psr7/NoSeekStream.php 3 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,15 +9,15 @@
 block discarded – undo
9 9
  */
10 10
 final class NoSeekStream implements StreamInterface
11 11
 {
12
-    use StreamDecoratorTrait;
13
-    /** @var StreamInterface */
14
-    private $stream;
15
-    public function seek($offset, $whence = \SEEK_SET) : void
16
-    {
17
-        throw new \RuntimeException('Cannot seek a NoSeekStream');
18
-    }
19
-    public function isSeekable() : bool
20
-    {
21
-        return \false;
22
-    }
12
+	use StreamDecoratorTrait;
13
+	/** @var StreamInterface */
14
+	private $stream;
15
+	public function seek($offset, $whence = \SEEK_SET) : void
16
+	{
17
+		throw new \RuntimeException('Cannot seek a NoSeekStream');
18
+	}
19
+	public function isSeekable() : bool
20
+	{
21
+		return \false;
22
+	}
23 23
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare (strict_types=1);
3
+declare(strict_types=1);
4 4
 namespace OCA\FullTextSearch_Elasticsearch\Vendor\GuzzleHttp\Psr7;
5 5
 
6 6
 use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\StreamInterface;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,8 +7,7 @@
 block discarded – undo
7 7
 /**
8 8
  * Stream decorator that prevents a stream from being seeked.
9 9
  */
10
-final class NoSeekStream implements StreamInterface
11
-{
10
+final class NoSeekStream implements StreamInterface {
12 11
     use StreamDecoratorTrait;
13 12
     /** @var StreamInterface */
14 13
     private $stream;
Please login to merge, or discard this patch.
lib/Vendor/GuzzleHttp/Psr7/Response.php 3 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare (strict_types=1);
3
+declare(strict_types=1);
4 4
 namespace OCA\FullTextSearch_Elasticsearch\Vendor\GuzzleHttp\Psr7;
5 5
 
6 6
 use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\ResponseInterface;
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         if ($reason == '' && isset(self::PHRASES[$this->statusCode])) {
36 36
             $this->reasonPhrase = self::PHRASES[$this->statusCode];
37 37
         } else {
38
-            $this->reasonPhrase = (string) $reason;
38
+            $this->reasonPhrase = (string)$reason;
39 39
         }
40 40
         $this->protocol = $version;
41 41
     }
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
     public function withStatus($code, $reasonPhrase = '') : ResponseInterface
51 51
     {
52 52
         $this->assertStatusCodeIsInteger($code);
53
-        $code = (int) $code;
53
+        $code = (int)$code;
54 54
         $this->assertStatusCodeRange($code);
55 55
         $new = clone $this;
56 56
         $new->statusCode = $code;
57 57
         if ($reasonPhrase == '' && isset(self::PHRASES[$new->statusCode])) {
58 58
             $reasonPhrase = self::PHRASES[$new->statusCode];
59 59
         }
60
-        $new->reasonPhrase = (string) $reasonPhrase;
60
+        $new->reasonPhrase = (string)$reasonPhrase;
61 61
         return $new;
62 62
     }
63 63
     /**
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,7 @@
 block discarded – undo
8 8
 /**
9 9
  * PSR-7 response implementation.
10 10
  */
11
-class Response implements ResponseInterface
12
-{
11
+class Response implements ResponseInterface {
13 12
     use MessageTrait;
14 13
     /** Map of standard HTTP status code/reason phrases */
15 14
     private const PHRASES = [100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-status', 208 => 'Already Reported', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => 'Switch Proxy', 307 => 'Temporary Redirect', 308 => 'Permanent Redirect', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Time-out', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Large', 415 => 'Unsupported Media Type', 416 => 'Requested range not satisfiable', 417 => 'Expectation Failed', 418 => 'I\'m a teapot', 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', 425 => 'Unordered Collection', 426 => 'Upgrade Required', 428 => 'Precondition Required', 429 => 'Too Many Requests', 431 => 'Request Header Fields Too Large', 451 => 'Unavailable For Legal Reasons', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Time-out', 505 => 'HTTP Version not supported', 506 => 'Variant Also Negotiates', 507 => 'Insufficient Storage', 508 => 'Loop Detected', 510 => 'Not Extended', 511 => 'Network Authentication Required'];
Please login to merge, or discard this patch.
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -10,69 +10,69 @@
 block discarded – undo
10 10
  */
11 11
 class Response implements ResponseInterface
12 12
 {
13
-    use MessageTrait;
14
-    /** Map of standard HTTP status code/reason phrases */
15
-    private const PHRASES = [100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-status', 208 => 'Already Reported', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => 'Switch Proxy', 307 => 'Temporary Redirect', 308 => 'Permanent Redirect', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Time-out', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Large', 415 => 'Unsupported Media Type', 416 => 'Requested range not satisfiable', 417 => 'Expectation Failed', 418 => 'I\'m a teapot', 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', 425 => 'Unordered Collection', 426 => 'Upgrade Required', 428 => 'Precondition Required', 429 => 'Too Many Requests', 431 => 'Request Header Fields Too Large', 451 => 'Unavailable For Legal Reasons', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Time-out', 505 => 'HTTP Version not supported', 506 => 'Variant Also Negotiates', 507 => 'Insufficient Storage', 508 => 'Loop Detected', 510 => 'Not Extended', 511 => 'Network Authentication Required'];
16
-    /** @var string */
17
-    private $reasonPhrase;
18
-    /** @var int */
19
-    private $statusCode;
20
-    /**
21
-     * @param int                                  $status  Status code
22
-     * @param (string|string[])[]                  $headers Response headers
23
-     * @param string|resource|StreamInterface|null $body    Response body
24
-     * @param string                               $version Protocol version
25
-     * @param string|null                          $reason  Reason phrase (when empty a default will be used based on the status code)
26
-     */
27
-    public function __construct(int $status = 200, array $headers = [], $body = null, string $version = '1.1', ?string $reason = null)
28
-    {
29
-        $this->assertStatusCodeRange($status);
30
-        $this->statusCode = $status;
31
-        if ($body !== '' && $body !== null) {
32
-            $this->stream = Utils::streamFor($body);
33
-        }
34
-        $this->setHeaders($headers);
35
-        if ($reason == '' && isset(self::PHRASES[$this->statusCode])) {
36
-            $this->reasonPhrase = self::PHRASES[$this->statusCode];
37
-        } else {
38
-            $this->reasonPhrase = (string) $reason;
39
-        }
40
-        $this->protocol = $version;
41
-    }
42
-    public function getStatusCode() : int
43
-    {
44
-        return $this->statusCode;
45
-    }
46
-    public function getReasonPhrase() : string
47
-    {
48
-        return $this->reasonPhrase;
49
-    }
50
-    public function withStatus($code, $reasonPhrase = '') : ResponseInterface
51
-    {
52
-        $this->assertStatusCodeIsInteger($code);
53
-        $code = (int) $code;
54
-        $this->assertStatusCodeRange($code);
55
-        $new = clone $this;
56
-        $new->statusCode = $code;
57
-        if ($reasonPhrase == '' && isset(self::PHRASES[$new->statusCode])) {
58
-            $reasonPhrase = self::PHRASES[$new->statusCode];
59
-        }
60
-        $new->reasonPhrase = (string) $reasonPhrase;
61
-        return $new;
62
-    }
63
-    /**
64
-     * @param mixed $statusCode
65
-     */
66
-    private function assertStatusCodeIsInteger($statusCode) : void
67
-    {
68
-        if (\filter_var($statusCode, \FILTER_VALIDATE_INT) === \false) {
69
-            throw new \InvalidArgumentException('Status code must be an integer value.');
70
-        }
71
-    }
72
-    private function assertStatusCodeRange(int $statusCode) : void
73
-    {
74
-        if ($statusCode < 100 || $statusCode >= 600) {
75
-            throw new \InvalidArgumentException('Status code must be an integer value between 1xx and 5xx.');
76
-        }
77
-    }
13
+	use MessageTrait;
14
+	/** Map of standard HTTP status code/reason phrases */
15
+	private const PHRASES = [100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-status', 208 => 'Already Reported', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => 'Switch Proxy', 307 => 'Temporary Redirect', 308 => 'Permanent Redirect', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Time-out', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Large', 415 => 'Unsupported Media Type', 416 => 'Requested range not satisfiable', 417 => 'Expectation Failed', 418 => 'I\'m a teapot', 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', 425 => 'Unordered Collection', 426 => 'Upgrade Required', 428 => 'Precondition Required', 429 => 'Too Many Requests', 431 => 'Request Header Fields Too Large', 451 => 'Unavailable For Legal Reasons', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Time-out', 505 => 'HTTP Version not supported', 506 => 'Variant Also Negotiates', 507 => 'Insufficient Storage', 508 => 'Loop Detected', 510 => 'Not Extended', 511 => 'Network Authentication Required'];
16
+	/** @var string */
17
+	private $reasonPhrase;
18
+	/** @var int */
19
+	private $statusCode;
20
+	/**
21
+	 * @param int                                  $status  Status code
22
+	 * @param (string|string[])[]                  $headers Response headers
23
+	 * @param string|resource|StreamInterface|null $body    Response body
24
+	 * @param string                               $version Protocol version
25
+	 * @param string|null                          $reason  Reason phrase (when empty a default will be used based on the status code)
26
+	 */
27
+	public function __construct(int $status = 200, array $headers = [], $body = null, string $version = '1.1', ?string $reason = null)
28
+	{
29
+		$this->assertStatusCodeRange($status);
30
+		$this->statusCode = $status;
31
+		if ($body !== '' && $body !== null) {
32
+			$this->stream = Utils::streamFor($body);
33
+		}
34
+		$this->setHeaders($headers);
35
+		if ($reason == '' && isset(self::PHRASES[$this->statusCode])) {
36
+			$this->reasonPhrase = self::PHRASES[$this->statusCode];
37
+		} else {
38
+			$this->reasonPhrase = (string) $reason;
39
+		}
40
+		$this->protocol = $version;
41
+	}
42
+	public function getStatusCode() : int
43
+	{
44
+		return $this->statusCode;
45
+	}
46
+	public function getReasonPhrase() : string
47
+	{
48
+		return $this->reasonPhrase;
49
+	}
50
+	public function withStatus($code, $reasonPhrase = '') : ResponseInterface
51
+	{
52
+		$this->assertStatusCodeIsInteger($code);
53
+		$code = (int) $code;
54
+		$this->assertStatusCodeRange($code);
55
+		$new = clone $this;
56
+		$new->statusCode = $code;
57
+		if ($reasonPhrase == '' && isset(self::PHRASES[$new->statusCode])) {
58
+			$reasonPhrase = self::PHRASES[$new->statusCode];
59
+		}
60
+		$new->reasonPhrase = (string) $reasonPhrase;
61
+		return $new;
62
+	}
63
+	/**
64
+	 * @param mixed $statusCode
65
+	 */
66
+	private function assertStatusCodeIsInteger($statusCode) : void
67
+	{
68
+		if (\filter_var($statusCode, \FILTER_VALIDATE_INT) === \false) {
69
+			throw new \InvalidArgumentException('Status code must be an integer value.');
70
+		}
71
+	}
72
+	private function assertStatusCodeRange(int $statusCode) : void
73
+	{
74
+		if ($statusCode < 100 || $statusCode >= 600) {
75
+			throw new \InvalidArgumentException('Status code must be an integer value between 1xx and 5xx.');
76
+		}
77
+	}
78 78
 }
Please login to merge, or discard this patch.
lib/Vendor/GuzzleHttp/Psr7/StreamWrapper.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare (strict_types=1);
3
+declare(strict_types=1);
4 4
 namespace OCA\FullTextSearch_Elasticsearch\Vendor\GuzzleHttp\Psr7;
5 5
 
6 6
 use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\StreamInterface;
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         } elseif ($stream->isWritable()) {
35 35
             $mode = 'w';
36 36
         } else {
37
-            throw new \InvalidArgumentException('The stream must be readable, ' . 'writable, or both.');
37
+            throw new \InvalidArgumentException('The stream must be readable, '.'writable, or both.');
38 38
         }
39 39
         return \fopen('guzzle://stream', $mode, \false, self::createStreamContext($stream));
40 40
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,7 @@
 block discarded – undo
9 9
  *
10 10
  * @see https://www.php.net/streamwrapper
11 11
  */
12
-final class StreamWrapper
13
-{
12
+final class StreamWrapper {
14 13
     /** @var resource */
15 14
     public $context;
16 15
     /** @var StreamInterface */
Please login to merge, or discard this patch.
Indentation   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -11,135 +11,135 @@
 block discarded – undo
11 11
  */
12 12
 final class StreamWrapper
13 13
 {
14
-    /** @var resource */
15
-    public $context;
16
-    /** @var StreamInterface */
17
-    private $stream;
18
-    /** @var string r, r+, or w */
19
-    private $mode;
20
-    /**
21
-     * Returns a resource representing the stream.
22
-     *
23
-     * @param StreamInterface $stream The stream to get a resource for
24
-     *
25
-     * @return resource
26
-     *
27
-     * @throws \InvalidArgumentException if stream is not readable or writable
28
-     */
29
-    public static function getResource(StreamInterface $stream)
30
-    {
31
-        self::register();
32
-        if ($stream->isReadable()) {
33
-            $mode = $stream->isWritable() ? 'r+' : 'r';
34
-        } elseif ($stream->isWritable()) {
35
-            $mode = 'w';
36
-        } else {
37
-            throw new \InvalidArgumentException('The stream must be readable, ' . 'writable, or both.');
38
-        }
39
-        return \fopen('guzzle://stream', $mode, \false, self::createStreamContext($stream));
40
-    }
41
-    /**
42
-     * Creates a stream context that can be used to open a stream as a php stream resource.
43
-     *
44
-     * @return resource
45
-     */
46
-    public static function createStreamContext(StreamInterface $stream)
47
-    {
48
-        return \stream_context_create(['guzzle' => ['stream' => $stream]]);
49
-    }
50
-    /**
51
-     * Registers the stream wrapper if needed
52
-     */
53
-    public static function register() : void
54
-    {
55
-        if (!\in_array('guzzle', \stream_get_wrappers())) {
56
-            \stream_wrapper_register('guzzle', __CLASS__);
57
-        }
58
-    }
59
-    public function stream_open(string $path, string $mode, int $options, ?string &$opened_path = null) : bool
60
-    {
61
-        $options = \stream_context_get_options($this->context);
62
-        if (!isset($options['guzzle']['stream'])) {
63
-            return \false;
64
-        }
65
-        $this->mode = $mode;
66
-        $this->stream = $options['guzzle']['stream'];
67
-        return \true;
68
-    }
69
-    public function stream_read(int $count) : string
70
-    {
71
-        return $this->stream->read($count);
72
-    }
73
-    public function stream_write(string $data) : int
74
-    {
75
-        return $this->stream->write($data);
76
-    }
77
-    public function stream_tell() : int
78
-    {
79
-        return $this->stream->tell();
80
-    }
81
-    public function stream_eof() : bool
82
-    {
83
-        return $this->stream->eof();
84
-    }
85
-    public function stream_seek(int $offset, int $whence) : bool
86
-    {
87
-        $this->stream->seek($offset, $whence);
88
-        return \true;
89
-    }
90
-    /**
91
-     * @return resource|false
92
-     */
93
-    public function stream_cast(int $cast_as)
94
-    {
95
-        $stream = clone $this->stream;
96
-        $resource = $stream->detach();
97
-        return $resource ?? \false;
98
-    }
99
-    /**
100
-     * @return array{
101
-     *   dev: int,
102
-     *   ino: int,
103
-     *   mode: int,
104
-     *   nlink: int,
105
-     *   uid: int,
106
-     *   gid: int,
107
-     *   rdev: int,
108
-     *   size: int,
109
-     *   atime: int,
110
-     *   mtime: int,
111
-     *   ctime: int,
112
-     *   blksize: int,
113
-     *   blocks: int
114
-     * }|false
115
-     */
116
-    public function stream_stat()
117
-    {
118
-        if ($this->stream->getSize() === null) {
119
-            return \false;
120
-        }
121
-        static $modeMap = ['r' => 33060, 'rb' => 33060, 'r+' => 33206, 'w' => 33188, 'wb' => 33188];
122
-        return ['dev' => 0, 'ino' => 0, 'mode' => $modeMap[$this->mode], 'nlink' => 0, 'uid' => 0, 'gid' => 0, 'rdev' => 0, 'size' => $this->stream->getSize() ?: 0, 'atime' => 0, 'mtime' => 0, 'ctime' => 0, 'blksize' => 0, 'blocks' => 0];
123
-    }
124
-    /**
125
-     * @return array{
126
-     *   dev: int,
127
-     *   ino: int,
128
-     *   mode: int,
129
-     *   nlink: int,
130
-     *   uid: int,
131
-     *   gid: int,
132
-     *   rdev: int,
133
-     *   size: int,
134
-     *   atime: int,
135
-     *   mtime: int,
136
-     *   ctime: int,
137
-     *   blksize: int,
138
-     *   blocks: int
139
-     * }
140
-     */
141
-    public function url_stat(string $path, int $flags) : array
142
-    {
143
-        return ['dev' => 0, 'ino' => 0, 'mode' => 0, 'nlink' => 0, 'uid' => 0, 'gid' => 0, 'rdev' => 0, 'size' => 0, 'atime' => 0, 'mtime' => 0, 'ctime' => 0, 'blksize' => 0, 'blocks' => 0];
144
-    }
14
+	/** @var resource */
15
+	public $context;
16
+	/** @var StreamInterface */
17
+	private $stream;
18
+	/** @var string r, r+, or w */
19
+	private $mode;
20
+	/**
21
+	 * Returns a resource representing the stream.
22
+	 *
23
+	 * @param StreamInterface $stream The stream to get a resource for
24
+	 *
25
+	 * @return resource
26
+	 *
27
+	 * @throws \InvalidArgumentException if stream is not readable or writable
28
+	 */
29
+	public static function getResource(StreamInterface $stream)
30
+	{
31
+		self::register();
32
+		if ($stream->isReadable()) {
33
+			$mode = $stream->isWritable() ? 'r+' : 'r';
34
+		} elseif ($stream->isWritable()) {
35
+			$mode = 'w';
36
+		} else {
37
+			throw new \InvalidArgumentException('The stream must be readable, ' . 'writable, or both.');
38
+		}
39
+		return \fopen('guzzle://stream', $mode, \false, self::createStreamContext($stream));
40
+	}
41
+	/**
42
+	 * Creates a stream context that can be used to open a stream as a php stream resource.
43
+	 *
44
+	 * @return resource
45
+	 */
46
+	public static function createStreamContext(StreamInterface $stream)
47
+	{
48
+		return \stream_context_create(['guzzle' => ['stream' => $stream]]);
49
+	}
50
+	/**
51
+	 * Registers the stream wrapper if needed
52
+	 */
53
+	public static function register() : void
54
+	{
55
+		if (!\in_array('guzzle', \stream_get_wrappers())) {
56
+			\stream_wrapper_register('guzzle', __CLASS__);
57
+		}
58
+	}
59
+	public function stream_open(string $path, string $mode, int $options, ?string &$opened_path = null) : bool
60
+	{
61
+		$options = \stream_context_get_options($this->context);
62
+		if (!isset($options['guzzle']['stream'])) {
63
+			return \false;
64
+		}
65
+		$this->mode = $mode;
66
+		$this->stream = $options['guzzle']['stream'];
67
+		return \true;
68
+	}
69
+	public function stream_read(int $count) : string
70
+	{
71
+		return $this->stream->read($count);
72
+	}
73
+	public function stream_write(string $data) : int
74
+	{
75
+		return $this->stream->write($data);
76
+	}
77
+	public function stream_tell() : int
78
+	{
79
+		return $this->stream->tell();
80
+	}
81
+	public function stream_eof() : bool
82
+	{
83
+		return $this->stream->eof();
84
+	}
85
+	public function stream_seek(int $offset, int $whence) : bool
86
+	{
87
+		$this->stream->seek($offset, $whence);
88
+		return \true;
89
+	}
90
+	/**
91
+	 * @return resource|false
92
+	 */
93
+	public function stream_cast(int $cast_as)
94
+	{
95
+		$stream = clone $this->stream;
96
+		$resource = $stream->detach();
97
+		return $resource ?? \false;
98
+	}
99
+	/**
100
+	 * @return array{
101
+	 *   dev: int,
102
+	 *   ino: int,
103
+	 *   mode: int,
104
+	 *   nlink: int,
105
+	 *   uid: int,
106
+	 *   gid: int,
107
+	 *   rdev: int,
108
+	 *   size: int,
109
+	 *   atime: int,
110
+	 *   mtime: int,
111
+	 *   ctime: int,
112
+	 *   blksize: int,
113
+	 *   blocks: int
114
+	 * }|false
115
+	 */
116
+	public function stream_stat()
117
+	{
118
+		if ($this->stream->getSize() === null) {
119
+			return \false;
120
+		}
121
+		static $modeMap = ['r' => 33060, 'rb' => 33060, 'r+' => 33206, 'w' => 33188, 'wb' => 33188];
122
+		return ['dev' => 0, 'ino' => 0, 'mode' => $modeMap[$this->mode], 'nlink' => 0, 'uid' => 0, 'gid' => 0, 'rdev' => 0, 'size' => $this->stream->getSize() ?: 0, 'atime' => 0, 'mtime' => 0, 'ctime' => 0, 'blksize' => 0, 'blocks' => 0];
123
+	}
124
+	/**
125
+	 * @return array{
126
+	 *   dev: int,
127
+	 *   ino: int,
128
+	 *   mode: int,
129
+	 *   nlink: int,
130
+	 *   uid: int,
131
+	 *   gid: int,
132
+	 *   rdev: int,
133
+	 *   size: int,
134
+	 *   atime: int,
135
+	 *   mtime: int,
136
+	 *   ctime: int,
137
+	 *   blksize: int,
138
+	 *   blocks: int
139
+	 * }
140
+	 */
141
+	public function url_stat(string $path, int $flags) : array
142
+	{
143
+		return ['dev' => 0, 'ino' => 0, 'mode' => 0, 'nlink' => 0, 'uid' => 0, 'gid' => 0, 'rdev' => 0, 'size' => 0, 'atime' => 0, 'mtime' => 0, 'ctime' => 0, 'blksize' => 0, 'blocks' => 0];
144
+	}
145 145
 }
Please login to merge, or discard this patch.