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

ducks-project / encoding-repair / 21231385783

22 Jan 2026 12:40AM UTC coverage: 79.793% (+3.8%) from 75.976%
21231385783

push

github

donaldinou
feat : coverage

3 of 5 new or added lines in 2 files covered. (60.0%)

18 existing lines in 2 files now uncovered.

308 of 386 relevant lines covered (79.79%)

7.36 hits per line

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

22.22
/Transcoder/MbStringTranscoder.php
1
<?php
2

3
/**
4
 * Part of EncodingRepair package.
5
 *
6
 * (c) Adrien Loyant <donald_duck@team-df.org>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
declare(strict_types=1);
13

14
namespace Ducks\Component\EncodingRepair\Transcoder;
15

16
/**
17
 * MbString-based transcoder (requires ext-mbstring).
18
 *
19
 * @final
20
 */
21
final class MbStringTranscoder implements TranscoderInterface
22
{
23
    /**
24
     * @inheritDoc
25
     */
26
    public function transcode(string $data, string $to, string $from, ?array $options = null): ?string
×
27
    {
28
        if (!$this->isAvailable()) {
×
29
            return null;
×
30
        }
31

32
        // Use silence operator (@) instead of set_error_handler
33
        // set_error_handler is too expensive for high-volume loops.
UNCOV
34
        $result = @\mb_convert_encoding($data, $to, $from);
×
35

36
        // @phpstan-ignore ternary.elseUnreachable
37
        return false !== $result ? $result : null;
×
38
    }
39

40
    /**
41
     * @inheritDoc
42
     */
43
    public function getPriority(): int
19✔
44
    {
45
        return 10;
19✔
46
    }
47

48
    /**
49
     * @inheritDoc
50
     */
51
    public function isAvailable(): bool
×
52
    {
53
        return \function_exists('mb_convert_encoding');
×
54
    }
55
}
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