ci4

Форк
0
/
ImageException.php 
120 строк · 2.7 Кб
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\Images\Exceptions;
15

16
use CodeIgniter\Exceptions\ExceptionInterface;
17
use CodeIgniter\Exceptions\FrameworkException;
18

19
class ImageException extends FrameworkException implements ExceptionInterface
20
{
21
    /**
22
     * Thrown when the image is not found.
23
     *
24
     * @return static
25
     */
26
    public static function forMissingImage()
27
    {
28
        return new static(lang('Images.sourceImageRequired'));
29
    }
30

31
    /**
32
     * Thrown when the file specific is not following the role.
33
     *
34
     * @return static
35
     */
36
    public static function forFileNotSupported()
37
    {
38
        return new static(lang('Images.fileNotSupported'));
39
    }
40

41
    /**
42
     * Thrown when the angle is undefined.
43
     *
44
     * @return static
45
     */
46
    public static function forMissingAngle()
47
    {
48
        return new static(lang('Images.rotationAngleRequired'));
49
    }
50

51
    /**
52
     * Thrown when the direction property is invalid.
53
     *
54
     * @return static
55
     */
56
    public static function forInvalidDirection(?string $dir = null)
57
    {
58
        return new static(lang('Images.invalidDirection', [$dir]));
59
    }
60

61
    /**
62
     * Thrown when the path property is invalid.
63
     *
64
     * @return static
65
     */
66
    public static function forInvalidPath()
67
    {
68
        return new static(lang('Images.invalidPath'));
69
    }
70

71
    /**
72
     * Thrown when the EXIF function is not supported.
73
     *
74
     * @return static
75
     */
76
    public static function forEXIFUnsupported()
77
    {
78
        return new static(lang('Images.exifNotSupported'));
79
    }
80

81
    /**
82
     * Thrown when the image specific is invalid.
83
     *
84
     * @return static
85
     */
86
    public static function forInvalidImageCreate(?string $extra = null)
87
    {
88
        return new static(lang('Images.unsupportedImageCreate') . ' ' . $extra);
89
    }
90

91
    /**
92
     * Thrown when the image save failed.
93
     *
94
     * @return static
95
     */
96
    public static function forSaveFailed()
97
    {
98
        return new static(lang('Images.saveFailed'));
99
    }
100

101
    /**
102
     * Thrown when the image library path is invalid.
103
     *
104
     * @return static
105
     */
106
    public static function forInvalidImageLibraryPath(?string $path = null)
107
    {
108
        return new static(lang('Images.libPathInvalid', [$path]));
109
    }
110

111
    /**
112
     * Thrown when the image process failed.
113
     *
114
     * @return static
115
     */
116
    public static function forImageProcessFailed()
117
    {
118
        return new static(lang('Images.imageProcessFailed'));
119
    }
120
}
121

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.