tutor
/
ecommerce
/
PaymentGateways
/
Paypal
/
vendor
/
guzzlehttp
/
guzzle
/
src
/
BodySummarizer.php
Cookie
2 months ago
Exception
2 months ago
Handler
2 months ago
BodySummarizer.php
1 year ago
BodySummarizerInterface.php
1 year ago
Client.php
2 months ago
ClientInterface.php
1 year ago
ClientTrait.php
1 year ago
HandlerStack.php
2 months ago
MessageFormatter.php
1 year ago
MessageFormatterInterface.php
1 year ago
Middleware.php
2 months ago
Pool.php
2 months ago
PrepareBodyMiddleware.php
2 months ago
RedirectMiddleware.php
2 months ago
RequestOptions.php
2 months ago
RetryMiddleware.php
2 months ago
TransferStats.php
1 year ago
TransportSharing.php
2 months ago
Utils.php
2 months ago
functions.php
2 months ago
functions_include.php
1 year ago
BodySummarizer.php
29 lines
| 1 | <?php |
| 2 | |
| 3 | namespace GuzzleHttp; |
| 4 | |
| 5 | use Psr\Http\Message\MessageInterface; |
| 6 | |
| 7 | final 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 | } |
| 29 |