ci4
66 строк · 1.5 Кб
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\Cache\Exceptions;
15
16use CodeIgniter\Exceptions\DebugTraceableTrait;
17use CodeIgniter\Exceptions\ExceptionInterface;
18use RuntimeException;
19
20/**
21* CacheException
22*/
23class CacheException extends RuntimeException implements ExceptionInterface
24{
25use DebugTraceableTrait;
26
27/**
28* Thrown when handler has no permission to write cache.
29*
30* @return CacheException
31*/
32public static function forUnableToWrite(string $path)
33{
34return new static(lang('Cache.unableToWrite', [$path]));
35}
36
37/**
38* Thrown when an unrecognized handler is used.
39*
40* @return CacheException
41*/
42public static function forInvalidHandlers()
43{
44return new static(lang('Cache.invalidHandlers'));
45}
46
47/**
48* Thrown when no backup handler is setup in config.
49*
50* @return CacheException
51*/
52public static function forNoBackup()
53{
54return new static(lang('Cache.noBackup'));
55}
56
57/**
58* Thrown when specified handler was not found.
59*
60* @return CacheException
61*/
62public static function forHandlerNotFound()
63{
64return new static(lang('Cache.handlerNotFound'));
65}
66}
67