Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| Filters | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | namespace Config; |
| 4 | |
| 5 | use CodeIgniter\Config\Filters as BaseFilters; |
| 6 | use CodeIgniter\Filters\Cors; |
| 7 | use CodeIgniter\Filters\CSRF; |
| 8 | use CodeIgniter\Filters\DebugToolbar; |
| 9 | use CodeIgniter\Filters\ForceHTTPS; |
| 10 | use CodeIgniter\Filters\Honeypot; |
| 11 | use CodeIgniter\Filters\InvalidChars; |
| 12 | use CodeIgniter\Filters\PageCache; |
| 13 | use CodeIgniter\Filters\PerformanceMetrics; |
| 14 | use CodeIgniter\Filters\SecureHeaders; |
| 15 | |
| 16 | class Filters extends BaseFilters |
| 17 | { |
| 18 | /** |
| 19 | * Configures aliases for Filter classes to |
| 20 | * make reading things nicer and simpler. |
| 21 | * |
| 22 | * @var array<string, class-string|list<class-string>> |
| 23 | * |
| 24 | * [filter_name => classname] |
| 25 | * or [filter_name => [classname1, classname2, ...]] |
| 26 | */ |
| 27 | public array $aliases = [ |
| 28 | 'csrf' => CSRF::class, |
| 29 | 'toolbar' => DebugToolbar::class, |
| 30 | 'honeypot' => Honeypot::class, |
| 31 | 'invalidchars' => InvalidChars::class, |
| 32 | 'secureheaders' => SecureHeaders::class, |
| 33 | 'cors' => Cors::class, |
| 34 | 'forcehttps' => ForceHTTPS::class, |
| 35 | 'pagecache' => PageCache::class, |
| 36 | 'performance' => PerformanceMetrics::class, |
| 37 | |
| 38 | 'auth' => \App\Filters\AuthFilter::class, |
| 39 | 'install' => \App\Filters\InstallationFilter::class, |
| 40 | |
| 41 | |
| 42 | // ERROS REPORTING |
| 43 | 'supportTelemetry' => \App\Modules\SupportModule\Filters\SupportTelemetryFilter::class, |
| 44 | ]; |
| 45 | |
| 46 | /** |
| 47 | * List of special required filters. |
| 48 | * |
| 49 | * The filters listed here are special. They are applied before and after |
| 50 | * other kinds of filters, and always applied even if a route does not exist. |
| 51 | * |
| 52 | * Filters set by default provide framework functionality. If removed, |
| 53 | * those functions will no longer work. |
| 54 | * |
| 55 | * @see https://codeigniter.com/user_guide/incoming/filters.html#provided-filters |
| 56 | * |
| 57 | * @var array{before: list<string>, after: list<string>} |
| 58 | */ |
| 59 | public array $required = [ |
| 60 | 'before' => [ |
| 61 | 'forcehttps', // Force Global Secure Requests |
| 62 | 'pagecache', // Web Page Caching |
| 63 | ], |
| 64 | 'after' => [ |
| 65 | 'pagecache', // Web Page Caching |
| 66 | 'performance', // Performance Metrics |
| 67 | 'toolbar', // Debug Toolbar |
| 68 | ], |
| 69 | ]; |
| 70 | |
| 71 | /** |
| 72 | * List of filter aliases that are always |
| 73 | * applied before and after every request. |
| 74 | * |
| 75 | * @var array{ |
| 76 | * before: array<string, array{except: list<string>|string}>|list<string>, |
| 77 | * after: array<string, array{except: list<string>|string}>|list<string> |
| 78 | * } |
| 79 | */ |
| 80 | public array $globals = [ |
| 81 | 'before' => [ |
| 82 | // 'honeypot', |
| 83 | // 'csrf', |
| 84 | // 'invalidchars', |
| 85 | ], |
| 86 | 'after' => [ |
| 87 | // 'honeypot', |
| 88 | // 'secureheaders', |
| 89 | 'supportTelemetry' |
| 90 | ], |
| 91 | ]; |
| 92 | |
| 93 | /** |
| 94 | * List of filter aliases that works on a |
| 95 | * particular HTTP method (GET, POST, etc.). |
| 96 | * |
| 97 | * Example: |
| 98 | * 'POST' => ['foo', 'bar'] |
| 99 | * |
| 100 | * If you use this, you should disable auto-routing because auto-routing |
| 101 | * permits any HTTP method to access a controller. Accessing the controller |
| 102 | * with a method you don't expect could bypass the filter. |
| 103 | * |
| 104 | * @var array<string, list<string>> |
| 105 | */ |
| 106 | public array $methods = []; |
| 107 | |
| 108 | /** |
| 109 | * List of filter aliases that should run on any |
| 110 | * before or after URI patterns. |
| 111 | * |
| 112 | * Example: |
| 113 | * 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']] |
| 114 | * |
| 115 | * @var array<string, array<string, list<string>>> |
| 116 | */ |
| 117 | public array $filters = [ ]; |
| 118 | } |