ci4
96 строк · 2.2 Кб
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\Exceptions;15
16use RuntimeException;17
18/**
19* Class FrameworkException
20*
21* A collection of exceptions thrown by the framework
22* that can only be determined at run time.
23*/
24class FrameworkException extends RuntimeException implements ExceptionInterface25{
26use DebugTraceableTrait;27
28/**29* @return static
30*/
31public static function forEnabledZlibOutputCompression()32{33return new static(lang('Core.enabledZlibOutputCompression'));34}35
36/**37* @return static
38*/
39public static function forInvalidFile(string $path)40{41return new static(lang('Core.invalidFile', [$path]));42}43
44/**45* @return static
46*/
47public static function forInvalidDirectory(string $path)48{49return new static(lang('Core.invalidDirectory', [$path]));50}51
52/**53* @return static
54*/
55public static function forCopyError(string $path)56{57return new static(lang('Core.copyError', [$path]));58}59
60/**61* @return static
62*
63* @deprecated 4.5.0 No longer used.
64*/
65public static function forMissingExtension(string $extension)66{67if (str_contains($extension, 'intl')) {68// @codeCoverageIgnoreStart69$message = sprintf(70'The framework needs the following extension(s) installed and loaded: %s.',71$extension72);73// @codeCoverageIgnoreEnd74} else {75$message = lang('Core.missingExtension', [$extension]);76}77
78return new static($message);79}80
81/**82* @return static
83*/
84public static function forNoHandlers(string $class)85{86return new static(lang('Core.noHandlers', [$class]));87}88
89/**90* @return static
91*/
92public static function forFabricatorCreateFailed(string $table, string $reason)93{94return new static(lang('Fabricator.createFailed', [$table, $reason]));95}96}
97