1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of Blitz PHP framework. |
5
|
|
|
* |
6
|
|
|
* (c) 2022 Dimitri Sitchet Tomkeu <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view |
9
|
|
|
* the LICENSE file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace BlitzPHP\Exceptions; |
13
|
|
|
|
14
|
|
|
use RuntimeException; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Class FrameworkException |
18
|
|
|
* |
19
|
|
|
* Une collection d'exceptions lancées par le framework |
20
|
|
|
* qui ne peut être déterminé qu'au moment de l'exécution. |
21
|
|
|
*/ |
22
|
|
|
class FrameworkException extends RuntimeException implements ExceptionInterface |
23
|
|
|
{ |
24
|
|
|
use DebugTraceableTrait; |
25
|
|
|
|
26
|
|
|
public static function enabledZlibOutputCompression() |
27
|
|
|
{ |
28
|
|
|
return new static(lang('Core.enabledZlibOutputCompression')); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public static function invalidFile(string $path) |
32
|
|
|
{ |
33
|
4 |
|
return new static(lang('Core.invalidFile', [$path])); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public static function copyError(string $path) |
37
|
|
|
{ |
38
|
|
|
return new static(lang('Core.copyError', [$path])); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public static function missingExtension(string $extension) |
42
|
|
|
{ |
43
|
|
|
if (str_contains($extension, 'intl')) { |
44
|
|
|
// @codeCoverageIgnoreStart |
45
|
|
|
$message = sprintf( |
46
|
|
|
'The framework needs the following extension(s) installed and loaded: %s.', |
47
|
|
|
$extension |
48
|
|
|
); |
49
|
|
|
// @codeCoverageIgnoreEnd |
50
|
|
|
} else { |
51
|
|
|
$message = lang('Core.missingExtension', [$extension]); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
return new static($message); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public static function noHandlers(string $class) |
58
|
|
|
{ |
59
|
|
|
return new static(lang('Core.noHandlers', [$class])); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
public static function fabricatorCreateFailed(string $table, string $reason) |
63
|
|
|
{ |
64
|
|
|
return new static(lang('Fabricator.createFailed', [$table, $reason])); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|