2015-05-02 07:26:43 +08:00
|
|
|
<?php namespace Flarum\Api;
|
|
|
|
|
|
|
|
use Tobscure\JsonApi\Document;
|
2015-05-27 06:29:31 +08:00
|
|
|
use Zend\Diactoros\Response;
|
2015-05-02 07:26:43 +08:00
|
|
|
|
|
|
|
class JsonApiResponse extends Response
|
|
|
|
{
|
2015-05-27 06:29:31 +08:00
|
|
|
public function __construct(Document $document)
|
2015-05-02 07:26:43 +08:00
|
|
|
{
|
2015-05-27 06:29:31 +08:00
|
|
|
parent::__construct('php://memory', 200, ['content-type' => 'application/vnd.api+json']);
|
2015-05-02 07:26:43 +08:00
|
|
|
|
2015-05-27 06:29:31 +08:00
|
|
|
$this->getBody()->write($document);
|
2015-05-02 07:26:43 +08:00
|
|
|
}
|
|
|
|
}
|