本文整理汇总了PHP中TYPO3\Flow\Http\Response::getContent方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::getContent方法的具体用法?PHP Response::getContent怎么用?PHP Response::getContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\Flow\Http\Response
的用法示例。
在下文中一共展示了Response::getContent方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param \TYPO3\Flow\Http\Response $response
* @param \TYPO3\Flow\Http\Request $request
*
* @throws \Flowpack\ElasticSearch\Transfer\Exception
* @throws \Flowpack\ElasticSearch\Transfer\Exception\ApiException
*/
public function __construct(\TYPO3\Flow\Http\Response $response, \TYPO3\Flow\Http\Request $request = null)
{
$this->originalResponse = $response;
$treatedContent = json_decode($response->getContent(), true);
if (strlen($response->getContent()) > 0) {
if ($treatedContent === null) {
throw new Exception('The request returned an invalid JSON string which was "' . $response->getContent() . '".', 1338976439, $response, $request);
}
if (array_key_exists('error', $treatedContent)) {
throw new Exception\ApiException($treatedContent['error'], 1338977435, $response, $request);
}
}
$this->treatedContent = $treatedContent;
}
示例2: logApiCall
/**
* @param string $url
* @param string $method
* @param Response $response
* @return void
*/
public function logApiCall($url, $method, Response $response)
{
if ($this->settings['gitApi']['requestListener']['log'] === TRUE) {
$directory = $this->getLogDirectory();
file_put_contents($directory . '/SurfCaptain_Request.log', $method . '_' . $url . "\n", FILE_APPEND);
file_put_contents($directory . '/SurfCaptain_Request.log', $response->getContent() . "\n", FILE_APPEND);
}
}
示例3: __construct
/**
*
*/
public function __construct($message, $code, \TYPO3\Flow\Http\Response $response, \TYPO3\Flow\Http\Request $request = NULL, \Exception $previous = NULL)
{
$this->response = $response;
$this->request = $request;
if ($request !== NULL) {
$message = sprintf("[%s %s]: %s\n\nRequest data: %s", $request->getMethod(), $request->getUri(), $message . '; Response body: ' . $response->getContent(), $request->getContent());
}
parent::__construct($message, $code, $previous);
}
示例4: render
/**
* Render this form.
*
* @return string rendered form
* @api
* @throws \TYPO3\Form\Exception\RenderingException
*/
public function render()
{
if ($this->isAfterLastPage()) {
$this->invokeFinishers();
return $this->response->getContent();
}
$this->formState->setLastDisplayedPageIndex($this->currentPage->getIndex());
if ($this->formDefinition->getRendererClassName() === NULL) {
throw new \TYPO3\Form\Exception\RenderingException(sprintf('The form definition "%s" does not have a rendererClassName set.', $this->formDefinition->getIdentifier()), 1326095912);
}
$rendererClassName = $this->formDefinition->getRendererClassName();
$renderer = new $rendererClassName();
if (!$renderer instanceof \TYPO3\Form\Core\Renderer\RendererInterface) {
throw new \TYPO3\Form\Exception\RenderingException(sprintf('The renderer "%s" des not implement RendererInterface', $rendererClassName), 1326096024);
}
$controllerContext = $this->getControllerContext();
$renderer->setControllerContext($controllerContext);
$renderer->setFormRuntime($this);
return $renderer->renderRenderable($this);
}
示例5: contentCanBeSetAppendedAndRetrieved
/**
* @test
*/
public function contentCanBeSetAppendedAndRetrieved()
{
$response = new Response();
$response->setContent('Two households, both alike in dignity, ');
$response->appendContent('In fair Verona, where we lay our scene');
$this->assertEquals('Two households, both alike in dignity, In fair Verona, where we lay our scene', $response->getContent());
$response->setContent('For never was a story of more woe, Than this of Juliet and her Romeo.');
$this->assertEquals('For never was a story of more woe, Than this of Juliet and her Romeo.', $response->getContent());
$this->assertEquals('For never was a story of more woe, Than this of Juliet and her Romeo.', (string) $response);
}
示例6: getCrawler
/**
* Returns the DOM crawler which can be used to interact with the web page
* structure, submit forms, click links or fetch specific parts of the
* website's contents.
*
* The returned DOM crawler is bound to the response of the last executed
* request.
*
* @return \Symfony\Component\DomCrawler\Crawler
* @api
*/
public function getCrawler()
{
$crawler = new Crawler(null, $this->lastRequest->getBaseUri());
$crawler->addContent($this->lastResponse->getContent(), $this->lastResponse->getHeader('Content-Type'));
return $crawler;
}
示例7: equals
public function equals($string)
{
$this->test->assertSame($string, $this->response->getContent(), 'The Response did not equal the string <' . $string . '>');
return $this;
}
示例8: render
/**
* @param string $path
* @return string
* @throws \Exception
*/
public function render($path = NULL)
{
if ($path === NULL) {
$path = '404';
}
/** @var RequestHandler $activeRequestHandler */
$activeRequestHandler = $this->bootstrap->getActiveRequestHandler();
$parentHttpRequest = $activeRequestHandler->getHttpRequest();
$requestPath = $parentHttpRequest->getUri()->getPath();
$language = explode('/', ltrim($requestPath, '/'))[0];
if ($language === 'neos') {
throw new \Exception('NotFoundViewHelper can not be used for neos-routes.', 1435648210);
}
$language = $this->localeDetector->detectLocaleFromLocaleTag($language)->getLanguage();
if ($this->contentDimensionPresetSource->findPresetByUriSegment('language', $language) === NULL) {
$language = '';
}
if ($language !== '') {
$language .= '/';
}
$request = Request::create(new Uri(rtrim($parentHttpRequest->getBaseUri(), '/') . '/' . $language . $path));
$matchingRoute = $this->router->route($request);
if (!$matchingRoute) {
throw new \Exception(sprintf('Uri with path "%s" could not be found.', rtrim($parentHttpRequest->getBaseUri(), '/') . '/' . $language . $path), 1426446160);
}
$response = new Response();
$objectManager = $this->bootstrap->getObjectManager();
$baseComponentChain = $objectManager->get('TYPO3\\Flow\\Http\\Component\\ComponentChain');
$componentContext = new ComponentContext($request, $response);
$baseComponentChain->handle($componentContext);
return $response->getContent();
}