• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

azjezz / psl / 23095146612

14 Mar 2026 07:51PM UTC coverage: 98.421% (-0.06%) from 98.483%
23095146612

push

github

web-flow
feat(encoding): introduce `Psl\Encoding\EncodedWord` (#628)

111 of 119 new or added lines in 12 files covered. (93.28%)

2 existing lines in 1 file now uncovered.

9976 of 10136 relevant lines covered (98.42%)

34.65 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.89
/src/Psl/Encoding/EncodedWord/Internal/decode_payload.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Psl\Encoding\EncodedWord\Internal;
6

7
use Psl\Encoding\EncodedWord;
8
use Psl\Encoding\Exception;
9

10
use function base64_decode;
11
use function strtoupper;
12

13
/**
14
 * Decode the payload of an RFC 2047 encoded-word.
15
 *
16
 * @internal
17
 *
18
 * @throws Exception\ParsingException If the encoding is unsupported or decoding fails.
19
 */
20
function decode_payload(string $encoding, string $text): string
21
{
22
    $encoding = strtoupper($encoding);
16✔
23

24
    if ($encoding === EncodedWord\B_ENCODING) {
16✔
25
        $decoded = base64_decode($text, true);
6✔
26
        if ($decoded === false) {
6✔
27
            throw Exception\ParsingException::forInvalidEncodedWord($text);
1✔
28
        }
29

30
        return $decoded;
5✔
31
    }
32

33
    if ($encoding === EncodedWord\Q_ENCODING) {
11✔
34
        return q_decode($text);
11✔
35
    }
36

NEW
37
    throw Exception\ParsingException::forInvalidEncodedWord($text);
×
38
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc