Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.
   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              ? \GuzzleHttp\Psr7\Message::bodySummary($message)
  26              : \GuzzleHttp\Psr7\Message::bodySummary($message, $this->truncateAt);
  27      }
  28  }