ci4
120 строк · 2.7 Кб
1<?php
2
3declare(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
14namespace CodeIgniter\Images\Exceptions;
15
16use CodeIgniter\Exceptions\ExceptionInterface;
17use CodeIgniter\Exceptions\FrameworkException;
18
19class ImageException extends FrameworkException implements ExceptionInterface
20{
21/**
22* Thrown when the image is not found.
23*
24* @return static
25*/
26public static function forMissingImage()
27{
28return new static(lang('Images.sourceImageRequired'));
29}
30
31/**
32* Thrown when the file specific is not following the role.
33*
34* @return static
35*/
36public static function forFileNotSupported()
37{
38return new static(lang('Images.fileNotSupported'));
39}
40
41/**
42* Thrown when the angle is undefined.
43*
44* @return static
45*/
46public static function forMissingAngle()
47{
48return new static(lang('Images.rotationAngleRequired'));
49}
50
51/**
52* Thrown when the direction property is invalid.
53*
54* @return static
55*/
56public static function forInvalidDirection(?string $dir = null)
57{
58return new static(lang('Images.invalidDirection', [$dir]));
59}
60
61/**
62* Thrown when the path property is invalid.
63*
64* @return static
65*/
66public static function forInvalidPath()
67{
68return new static(lang('Images.invalidPath'));
69}
70
71/**
72* Thrown when the EXIF function is not supported.
73*
74* @return static
75*/
76public static function forEXIFUnsupported()
77{
78return new static(lang('Images.exifNotSupported'));
79}
80
81/**
82* Thrown when the image specific is invalid.
83*
84* @return static
85*/
86public static function forInvalidImageCreate(?string $extra = null)
87{
88return new static(lang('Images.unsupportedImageCreate') . ' ' . $extra);
89}
90
91/**
92* Thrown when the image save failed.
93*
94* @return static
95*/
96public static function forSaveFailed()
97{
98return new static(lang('Images.saveFailed'));
99}
100
101/**
102* Thrown when the image library path is invalid.
103*
104* @return static
105*/
106public static function forInvalidImageLibraryPath(?string $path = null)
107{
108return new static(lang('Images.libPathInvalid', [$path]));
109}
110
111/**
112* Thrown when the image process failed.
113*
114* @return static
115*/
116public static function forImageProcessFailed()
117{
118return new static(lang('Images.imageProcessFailed'));
119}
120}
121