private function checkContentDispositionFilename(HeadersSet $headersSet, $filename) { $this->assertTrue($headersSet->hasHeaders("Content-Disposition")); $headers = $headersSet->getHeaders("Content-Disposition"); $this->assertInternalType('array', $headers); $this->assertContains($filename, $headers[0]); }
public function __construct($exceptionString, $statusCode, $reasonPhrase = null) { $fullText = $this->getBeforeText(); $fullText .= nl2br($exceptionString); $fullText .= $this->getAfterText(); $this->text = $fullText; $this->statusCode = $statusCode; $this->reasonPhrase = $reasonPhrase; $this->headersSet = new HeadersSet(); $this->headersSet->addHeader('Content-Type', 'text/html; charset=UTF-8; charset=utf-8'); $this->headersSet->addHeader('Content-Length', strlen($this->text)); }
public static function createImageTask(VariableMap $variableMap, ImagickTaskQueue $taskQueue, PageInfo $pageInfo, Request $request, HeadersSet $headersSet, $customImage, $params) { $job = $variableMap->getVariable('job', false); $text = "Image is still generating."; if ($job === false) { if ($taskQueue->isActive() == false) { //Queue isn't active - don't bother queueing a task return false; } $task = new \ImagickDemo\Queue\ImagickTask($pageInfo, $params, $customImage, $request->getUri()->getPath()); $added = $taskQueue->addTask($task); if ($added === true) { $text = "Image added to task list"; } else { $text = "Image task {$added} already present."; } } $caching = new \Room11\Caching\LastModified\Disabled(); foreach ($caching->getHeaders(time()) as $key => $value) { $headersSet->addHeader($key, $value); } return new TextBody($text, 420); }
/** * @param Session $session * @param HeadersSet $headerSet * @return int */ public static function addSessionHeader(Session $session, HeadersSet $headerSet) { $headers = $session->getHeaders(\ASM\SessionManager::CACHE_PRIVATE); foreach ($headers as $key => $value) { $headerSet->addHeader($key, $value); } $session->save(); return TierApp::PROCESS_CONTINUE; }
/** * Return an instance without the specified header. * * Header resolution MUST be done without case-sensitivity. * * This method MUST be implemented in such a way as to retain the * immutability of the message, and MUST return an instance that removes * the named header. * * @param string $name Case-insensitive header field name to remove. * @return self */ public function withoutHeader($name) { $instance = clone $this; $allHeaders = $instance->headersSet->getAllHeaders(); $newHeaders = []; foreach ($allHeaders as $existingName => $existingValues) { if (strcasecmp($existingName, $name) === 0) { continue; } else { $newHeaders[$existingName] = $existingValues; } } $instance->headersSet = HeadersSet::fromArray($newHeaders); return $instance; }