Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.8] Add constant for default truncateAt of bodySummary() #596

Open
wants to merge 1 commit into
base: 2.7
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@

final class Message
{
/**
* Default maximum allowed size of the short summary of the message body.
*/
public const BODY_SUMMARY_TRUNCATE_AT = 120;

/**
* Returns the string representation of an HTTP message.
*
Expand Down Expand Up @@ -53,7 +58,7 @@ public static function toString(MessageInterface $message): string
* @param MessageInterface $message The message to get the body summary
* @param int $truncateAt The maximum allowed size of the summary
*/
public static function bodySummary(MessageInterface $message, int $truncateAt = 120): ?string
public static function bodySummary(MessageInterface $message, int $truncateAt = self::BODY_SUMMARY_TRUNCATE_AT): ?string
{
$body = $message->getBody();

Expand Down