public function testGetFormatWithNTriples() { $data = file_get_contents('../data/nt/test.nt'); $actual = ARC2::getFormat($data); $this->assertEquals('ntriples', $actual); $actual = ARC2::getFormat($data, '', 'nt'); $this->assertEquals('ntriples', $actual); }
function getFormat() { if (!$this->format) { if (!$this->v('stream')) { return $this->addError('missing stream in "getFormat"'); } $v = $this->readStream(false); $mtype = $this->v('format', '', $this->stream['headers']); $this->stream['buffer'] = $v . $this->stream['buffer']; $ext = preg_match('/\\.([^\\.]+)$/', $this->uri, $m) ? $m[1] : ''; $this->format = ARC2::getFormat($v, $mtype, $ext); } return $this->format; }