1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
<?php
/*
* This file is part of the ICanBoogie package.
*
* (c) Olivier Laviale <olivier.laviale@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ICanBoogie\HTTP\Headers;
/**
* Representation of the `Content-Disposition` header field.
*
* <pre>
* <?php
*
* use ICanBoogie\HTTP\Headers\ContentDisposition;
*
* $cd = new ContentDisposition;
* $cd->type = attachment;
* $cd->filename = "Résumé en €.csv";
*
* echo $cd; // attachment; filename*=UTF-8''R%C3%A9sum%C3%A9%20en%20%E2%82%AC.csv
* </pre>
*
* @property string $type The `disposition-type` part of the content disposition. Alias to {@link $value}.
* @property string $filename The `filename-parm` part of the content disposition.
*
* @see http://tools.ietf.org/html/rfc2616#section-19.5.1
* @see http://tools.ietf.org/html/rfc6266
*/
class ContentDisposition extends Header
{
const VALUE_ALIAS = 'type';
/**
* Defines the `filename` parameter.
*
* @inheritdoc
*/
public function __construct($value=null, array $attributes=[])
{
$this->parameters['filename'] = new HeaderParameter('filename');
parent::__construct($value, $attributes);
}
}