summaryrefslogtreecommitdiff
path: root/vendor/guzzlehttp/guzzle/src/BodySummarizer.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/guzzlehttp/guzzle/src/BodySummarizer.php')
-rw-r--r--vendor/guzzlehttp/guzzle/src/BodySummarizer.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/vendor/guzzlehttp/guzzle/src/BodySummarizer.php b/vendor/guzzlehttp/guzzle/src/BodySummarizer.php
new file mode 100644
index 000000000..6eca94ef9
--- /dev/null
+++ b/vendor/guzzlehttp/guzzle/src/BodySummarizer.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace GuzzleHttp;
+
+use Psr\Http\Message\MessageInterface;
+
+final class BodySummarizer implements BodySummarizerInterface
+{
+ /**
+ * @var int|null
+ */
+ private $truncateAt;
+
+ public function __construct(int $truncateAt = null)
+ {
+ $this->truncateAt = $truncateAt;
+ }
+
+ /**
+ * Returns a summarized message body.
+ */
+ public function summarize(MessageInterface $message): ?string
+ {
+ return $this->truncateAt === null
+ ? \GuzzleHttp\Psr7\Message::bodySummary($message)
+ : \GuzzleHttp\Psr7\Message::bodySummary($message, $this->truncateAt);
+ }
+}