79 lines
1.7 KiB
PHP
79 lines
1.7 KiB
PHP
<?php
|
|
namespace TYPO3\CMS\Extbase\Mvc;
|
|
|
|
/*
|
|
* This file is part of the TYPO3 CMS project.
|
|
*
|
|
* It is free software; you can redistribute it and/or modify it under
|
|
* the terms of the GNU General Public License, either version 2
|
|
* of the License, or any later version.
|
|
*
|
|
* For the full copyright and license information, please read the
|
|
* LICENSE.txt file that was distributed with this source code.
|
|
*
|
|
* The TYPO3 project - inspiring people to share!
|
|
*/
|
|
|
|
/**
|
|
* A generic and very basic response implementation
|
|
*/
|
|
class Response implements \TYPO3\CMS\Extbase\Mvc\ResponseInterface
|
|
{
|
|
/**
|
|
* @var string The response content
|
|
*/
|
|
protected $content;
|
|
|
|
/**
|
|
* Overrides and sets the content of the response
|
|
*
|
|
* @param string $content The response content
|
|
*/
|
|
public function setContent($content)
|
|
{
|
|
$this->content = $content;
|
|
}
|
|
|
|
/**
|
|
* Appends content to the already existing content.
|
|
*
|
|
* @param string $content More response content
|
|
*/
|
|
public function appendContent($content)
|
|
{
|
|
$this->content .= $content;
|
|
}
|
|
|
|
/**
|
|
* Returns the response content without sending it.
|
|
*
|
|
* @return string The response content
|
|
*/
|
|
public function getContent()
|
|
{
|
|
return $this->content;
|
|
}
|
|
|
|
/**
|
|
* Fetches the content, returns and clears it.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function shutdown()
|
|
{
|
|
$content = $this->getContent();
|
|
$this->setContent('');
|
|
return $content;
|
|
}
|
|
|
|
/**
|
|
* Returns the content of the response.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function __toString()
|
|
{
|
|
return $this->getContent();
|
|
}
|
|
}
|