Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| BaseController | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| initController | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Controllers; |
| 4 | |
| 5 | use CodeIgniter\Controller; |
| 6 | use CodeIgniter\HTTP\RequestInterface; |
| 7 | use CodeIgniter\HTTP\ResponseInterface; |
| 8 | use Psr\Log\LoggerInterface; |
| 9 | |
| 10 | /** |
| 11 | * BaseController provides a convenient place for loading components |
| 12 | * and performing functions that are needed by all your controllers. |
| 13 | * |
| 14 | * Extend this class in any new controllers: |
| 15 | * ``` |
| 16 | * class Home extends BaseController |
| 17 | * ``` |
| 18 | * |
| 19 | * For security, be sure to declare any new methods as protected or private. |
| 20 | */ |
| 21 | abstract class BaseController extends Controller |
| 22 | { |
| 23 | /** |
| 24 | * Be sure to declare properties for any property fetch you initialized. |
| 25 | * The creation of dynamic property is deprecated in PHP 8.2. |
| 26 | */ |
| 27 | |
| 28 | // protected $session; |
| 29 | |
| 30 | /** |
| 31 | * @return void |
| 32 | */ |
| 33 | public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) |
| 34 | { |
| 35 | // Load here all helpers you want to be available in your controllers that extend BaseController. |
| 36 | // Caution: Do not put the this below the parent::initController() call below. |
| 37 | // $this->helpers = ['form', 'url']; |
| 38 | |
| 39 | // Caution: Do not edit this line. |
| 40 | parent::initController($request, $response, $logger); |
| 41 | |
| 42 | // Preload any models, libraries, etc, here. |
| 43 | // $this->session = service('session'); |
| 44 | } |
| 45 | } |