PluginProbe
Depicter — Popup & Slider Builder / 1.5.2
Depicter — Popup & Slider Builder v1.5.2
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
depicter / modules / GuzzleHttp / BodySummarizer.php

BodySummarizer.php in Depicter — Popup & Slider Builder 1.5.2, at modules/GuzzleHttp/BodySummarizer.php

29 lines 667 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Depicter\GuzzleHttp;
4
5 use Depicter\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 ? \Depicter\GuzzleHttp\Psr7\Message::bodySummary($message)
26 : \Depicter\GuzzleHttp\Psr7\Message::bodySummary($message, $this->truncateAt);
27 }
28 }
29