PlainTextView.php 950 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  5. * Copyright (c) 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 (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  11. * @link https://cakephp.org CakePHP(tm) Project
  12. * @since 4.4.0
  13. * @license https://opensource.org/licenses/mit-license.php MIT License
  14. */
  15. namespace TestApp\View;
  16. use Cake\View\View;
  17. /**
  18. * CustomJsonView class
  19. */
  20. class PlainTextView extends View
  21. {
  22. /**
  23. * @inheritDoc
  24. */
  25. public static function contentType(): string
  26. {
  27. return 'text/plain';
  28. }
  29. /**
  30. * @inheritDoc
  31. */
  32. public function render(?string $template = null, $layout = null): string
  33. {
  34. return $this->get('body') ?? '';
  35. }
  36. }