Esempio n. 1
0
 public function testCanMinimize()
 {
     $obj = new Document();
     $obj->setControl('self', '/path', ['title' => 'My Title']);
     $obj->minimize();
     $this->assertObjectNotHasAttribute('title', $obj->{'@controls'}->self);
 }
 protected function makeMasonResponse(Document $document, Request $request, array $routeParams = [], $status = 200, array $headers = [])
 {
     $url = static::getProfileUrl();
     $document->setMetaControl('profile', new Control($url));
     if (isset($headers['Link']) && !is_array($headers['Link'])) {
         $headers['Link'] = [$headers['Link']];
     }
     $headers['Link'][] = sprintf('<%s>; rel="profile"', $url);
     if (!isset($document->{'@controls'}->self)) {
         $document->setControl('self', static::class, $routeParams);
     }
     if (method_exists($this, 'addMasonNamespaces')) {
         $this->addMasonNamespaces($document);
     }
     return MasonResponse::create($document, $request, $status, $headers, JSON_UNESCAPED_SLASHES);
 }