CakesController.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace TestApp\Controller;
  3. use Cake\Controller\Controller;
  4. /**
  5. * CakesController class
  6. */
  7. class CakesController extends Controller
  8. {
  9. /**
  10. * The default model to use.
  11. *
  12. * @var string
  13. */
  14. public $modelClass = 'Posts';
  15. /**
  16. * index method
  17. *
  18. * @return \Cake\Http\Response
  19. */
  20. public function index()
  21. {
  22. return $this->response->withStringBody('Hello Jane');
  23. }
  24. /**
  25. * No autoRender
  26. *
  27. * @return void
  28. */
  29. public function noRender()
  30. {
  31. $this->autoRender = false;
  32. $this->response = $this->response->withStringBody('autoRender false body');
  33. }
  34. /**
  35. * invalid method
  36. *
  37. * @return string
  38. */
  39. public function invalid()
  40. {
  41. return 'Some string';
  42. }
  43. /**
  44. * startup process.
  45. */
  46. public function startupProcess()
  47. {
  48. parent::startupProcess();
  49. if ($this->request->getParam('stop') === 'startup') {
  50. return $this->response->withStringBody('startup stop');
  51. }
  52. }
  53. /**
  54. * shutdown process.
  55. */
  56. public function shutdownProcess()
  57. {
  58. parent::shutdownProcess();
  59. if ($this->request->getParam('stop') === 'shutdown') {
  60. return $this->response->withStringBody('shutdown stop');
  61. }
  62. }
  63. }