示例#1
0
 public function testMetaDisappearsIfNoPropertiesOnMinimization()
 {
     $obj = new Document();
     $obj->addMetaProperty('foo', 'bar');
     $obj->minimize();
     $this->assertObjectNotHasAttribute('@meta', $obj);
 }
 private function applyPreferHeader(Document $document, Request $request, &$headers, &$options)
 {
     $prefer = $request->headers->get('Prefer');
     $minimal = preg_match("/\\brepresentation\\s*=\\s*(minimal\\b|\"minimal\")/i", $prefer);
     if ($minimal) {
         $document->minimize();
         if ($options >= JSON_PRETTY_PRINT) {
             $options -= JSON_PRETTY_PRINT;
         }
         $headers['Preference-Applied'] = 'representation=minimal';
     } elseif ($options < JSON_PRETTY_PRINT) {
         $options += JSON_PRETTY_PRINT;
     }
 }