Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 9... Línea 9...
9
    /**
9
    /**
10
     * @var int|null
10
     * @var int|null
11
     */
11
     */
12
    private $truncateAt;
12
    private $truncateAt;
Línea 13... Línea 13...
13
 
13
 
14
    public function __construct(int $truncateAt = null)
14
    public function __construct(?int $truncateAt = null)
15
    {
15
    {
16
        $this->truncateAt = $truncateAt;
16
        $this->truncateAt = $truncateAt;
Línea 17... Línea 17...
17
    }
17
    }
18
 
18
 
19
    /**
19
    /**
20
     * Returns a summarized message body.
20
     * Returns a summarized message body.
21
     */
21
     */
22
    public function summarize(MessageInterface $message): ?string
22
    public function summarize(MessageInterface $message): ?string
23
    {
23
    {
24
        return $this->truncateAt === null
24
        return $this->truncateAt === null
25
            ? \GuzzleHttp\Psr7\Message::bodySummary($message)
25
            ? Psr7\Message::bodySummary($message)
26
            : \GuzzleHttp\Psr7\Message::bodySummary($message, $this->truncateAt);
26
            : Psr7\Message::bodySummary($message, $this->truncateAt);