ComponentTestController.php 1010 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  5. * Copyright 2005-2011, Cake Software Foundation, Inc. (https://cakefoundation.org)
  6. *
  7. * Licensed under The MIT License
  8. * Redistributions of files must retain the above copyright notice.
  9. *
  10. * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (https://cakefoundation.org)
  11. * @link https://cakephp.org CakePHP(tm) Project
  12. * @since 3.0.0
  13. * @license https://opensource.org/licenses/mit-license.php MIT License
  14. */
  15. namespace TestApp\Controller;
  16. use Cake\Controller\Controller;
  17. /**
  18. * ComponentTestController class
  19. */
  20. class ComponentTestController extends Controller
  21. {
  22. public function initialize(): void
  23. {
  24. parent::initialize();
  25. $this->loadComponent('Flash');
  26. }
  27. public function flash()
  28. {
  29. return $this->response->withStringBody(json_encode([
  30. 'flashKey' => $this->Flash->getConfig('key'),
  31. ]));
  32. }
  33. }