/**
* @param Node|string|int $page Node model, url or node id. Use Jarves\Model\Node::createPage()
* @param string|array|null $contents
*
* @return PageResponse
*/
public function createFromPage($page, $contents = null)
{
$page = $this->pageStack->getPage($page);
if (!$page) {
throw new \InvalidArgumentException('Can not find page.');
}
$this->pageStack->setCurrentPage($page);
$pageResponse = new PageResponse('', 200, [], $this->pageStack, $this->jarves, $this->stopwatch, $this->assetCompilerContainer, $this->eventDispatcher, $this->templating, $this->editMode);
$this->pageStack->setPageResponse($pageResponse);
if (null !== $contents) {
$pageResponse->setPageContent($contents);
}
return $pageResponse;
}