source: vendor/guzzlehttp/guzzle/src/BodySummarizer.php

Last change on this file was e3d4e0a, checked in by Vlado 222039 <vlado.popovski@…>, 7 days ago

Upload project files

  • Property mode set to 100644
File size: 608 bytes
RevLine 
[e3d4e0a]1<?php
2
3namespace GuzzleHttp;
4
5use Psr\Http\Message\MessageInterface;
6
7final class BodySummarizer implements BodySummarizerInterface
8{
9 /**
10 * @var int|null
11 */
12 private $truncateAt;
13
14 public function __construct(?int $truncateAt = null)
15 {
16 $this->truncateAt = $truncateAt;
17 }
18
19 /**
20 * Returns a summarized message body.
21 */
22 public function summarize(MessageInterface $message): ?string
23 {
24 return $this->truncateAt === null
25 ? Psr7\Message::bodySummary($message)
26 : Psr7\Message::bodySummary($message, $this->truncateAt);
27 }
28}
Note: See TracBrowser for help on using the repository browser.