public function testConstructor() { $ot = new OutputType(OutputType::JSON); $this->assertSame(OutputType::JSON, $ot->getCode(), "getCode() must match constructor value"); }
/** * @see https://developers.google.com/chart/interactive/docs/dev/implementing_data_source#security_considerations * @param OutputType $outputType * @throws AccessDeniedException */ public function verifyAccessAllowed(OutputType $outputType) { // Check HTTP headers to make sure the SAME_ORIGIN_HEADER // was sent with the request. $outputCode = $outputType->getCode(); if ($outputCode !== OutputType::HTML && $outputCode !== OutputType::CSV && $outputCode !== OutputType::TSV_EXCEL && !$this->isSameOrigin()) { throw new AccessDeniedException(); } }