- Created CHANGELOG.md to maintain version history. - Added README.md with usage instructions for the trigger_deprecation() function. - Initialized composer.json for the Symfony Deprecation Contracts library, specifying dependencies and autoloading.
23 lines
664 B
PHP
23 lines
664 B
PHP
<?php
|
|
|
|
namespace PShowSsoScoped\GuzzleHttp;
|
|
|
|
use PShowSsoScoped\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 ? \PShowSsoScoped\GuzzleHttp\Psr7\Message::bodySummary($message) : \PShowSsoScoped\GuzzleHttp\Psr7\Message::bodySummary($message, $this->truncateAt);
|
|
}
|
|
} |