TestsAppsController.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * TestsAppsController file
  4. *
  5. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  6. * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  7. *
  8. * Licensed under The MIT License
  9. * For full copyright and license information, please see the LICENSE.txt
  10. * Redistributions of files must retain the above copyright notice
  11. *
  12. * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  13. * @link http://cakephp.org CakePHP(tm) Project
  14. * @since 1.2.0
  15. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  16. */
  17. /**
  18. * TestsAppsController
  19. */
  20. namespace TestApp\Controller;
  21. class TestsAppsController extends AppController
  22. {
  23. public $components = ['RequestHandler'];
  24. public function index()
  25. {
  26. $var = '';
  27. if (isset($this->request->query['var'])) {
  28. $var = $this->request->query['var'];
  29. }
  30. $this->set('var', $var);
  31. }
  32. public function some_method()
  33. {
  34. $this->response->body(5);
  35. return $this->response;
  36. }
  37. public function set_action()
  38. {
  39. $this->set('var', 'string');
  40. $this->render('index');
  41. }
  42. public function redirect_to()
  43. {
  44. return $this->redirect('http://cakephp.org');
  45. }
  46. public function redirect_to_permanent()
  47. {
  48. return $this->redirect('http://cakephp.org', 301);
  49. }
  50. public function set_type()
  51. {
  52. $this->response->type('json');
  53. return $this->response;
  54. }
  55. public function throw_exception()
  56. {
  57. throw new \RuntimeException('Foo');
  58. }
  59. }