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

codeigniter4 / CodeIgniter4 / 12673986434

08 Jan 2025 03:42PM UTC coverage: 84.455% (+0.001%) from 84.454%
12673986434

Pull #9385

github

web-flow
Merge 06e47f0ee into e475fd8fa
Pull Request #9385: refactor: Fix phpstan expr.resultUnused

20699 of 24509 relevant lines covered (84.45%)

190.57 hits per line

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

75.0
/system/Format/Exceptions/FormatException.php
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * This file is part of CodeIgniter 4 framework.
7
 *
8
 * (c) CodeIgniter Foundation <admin@codeigniter.com>
9
 *
10
 * For the full copyright and license information, please view
11
 * the LICENSE file that was distributed with this source code.
12
 */
13

14
namespace CodeIgniter\Format\Exceptions;
15

16
use CodeIgniter\Exceptions\DebugTraceableTrait;
17
use CodeIgniter\Exceptions\RuntimeException;
18

19
/**
20
 * FormatException
21
 */
22
class FormatException extends RuntimeException
23
{
24
    use DebugTraceableTrait;
25

26
    /**
27
     * Thrown when the instantiated class does not exist.
28
     *
29
     * @return static
30
     */
31
    public static function forInvalidFormatter(string $class)
32
    {
33
        return new static(lang('Format.invalidFormatter', [$class]));
2✔
34
    }
35

36
    /**
37
     * Thrown in JSONFormatter when the json_encode produces
38
     * an error code other than JSON_ERROR_NONE and JSON_ERROR_RECURSION.
39
     *
40
     * @param string $error The error message
41
     *
42
     * @return static
43
     */
44
    public static function forInvalidJSON(?string $error = null)
45
    {
46
        return new static(lang('Format.invalidJSON', [$error]));
1✔
47
    }
48

49
    /**
50
     * Thrown when the supplied MIME type has no
51
     * defined Formatter class.
52
     *
53
     * @return static
54
     */
55
    public static function forInvalidMime(string $mime)
56
    {
57
        return new static(lang('Format.invalidMime', [$mime]));
1✔
58
    }
59

60
    /**
61
     * Thrown on XMLFormatter when the `simplexml` extension
62
     * is not installed.
63
     *
64
     * @return static
65
     *
66
     * @codeCoverageIgnore
67
     */
68
    public static function forMissingExtension()
69
    {
70
        return new static(lang('Format.missingExtension'));
×
71
    }
72
}
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

© 2025 Coveralls, Inc