PHP 클래스 Symfony\Component\HttpFoundation\HeaderBag

저자: Fabien Potencier ([email protected])
파일 보기 프로젝트 열기: symfony/symfony 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$cacheControl
$headers

공개 메소드들

메소드 설명
__construct ( array $headers = [] ) Constructor.
__toString ( ) : string Returns the headers as a string.
add ( array $headers ) Adds new headers the current HTTP headers set.
addCacheControlDirective ( string $key, mixed $value = true ) Adds a custom Cache-Control directive.
all ( ) : array Returns the headers.
contains ( string $key, string $value ) : boolean Returns true if the given HTTP header contains the given value.
count ( ) : integer Returns the number of headers.
get ( string $key, mixed $default = null, boolean $first = true ) : string | array Returns a header value by name.
getCacheControlDirective ( string $key ) : mixed | null Returns a Cache-Control directive value by name.
getDate ( string $key, DateTime $default = null ) : null | DateTime Returns the HTTP header value converted to a date.
getIterator ( ) : ArrayIterator Returns an iterator for headers.
has ( string $key ) : boolean Returns true if the HTTP header is defined.
hasCacheControlDirective ( string $key ) : boolean Returns true if the Cache-Control directive is defined.
keys ( ) : array Returns the parameter keys.
remove ( string $key ) Removes a header.
removeCacheControlDirective ( string $key ) Removes a Cache-Control directive.
replace ( array $headers = [] ) Replaces the current HTTP headers by a new set.
set ( string $key, string | array $values, boolean $replace = true ) Sets a header by name.

보호된 메소드들

메소드 설명
getCacheControlHeader ( )
parseCacheControl ( string $header ) : array Parses a Cache-Control HTTP header.

메소드 상세

__construct() 공개 메소드

Constructor.
public __construct ( array $headers = [] )
$headers array An array of HTTP headers

__toString() 공개 메소드

Returns the headers as a string.
public __toString ( ) : string
리턴 string The headers

add() 공개 메소드

Adds new headers the current HTTP headers set.
public add ( array $headers )
$headers array An array of HTTP headers

addCacheControlDirective() 공개 메소드

Adds a custom Cache-Control directive.
public addCacheControlDirective ( string $key, mixed $value = true )
$key string The Cache-Control directive name
$value mixed The Cache-Control directive value

all() 공개 메소드

Returns the headers.
public all ( ) : array
리턴 array An array of headers

contains() 공개 메소드

Returns true if the given HTTP header contains the given value.
public contains ( string $key, string $value ) : boolean
$key string The HTTP header name
$value string The HTTP value
리턴 boolean true if the value is contained in the header, false otherwise

count() 공개 메소드

Returns the number of headers.
public count ( ) : integer
리턴 integer The number of headers

get() 공개 메소드

Returns a header value by name.
public get ( string $key, mixed $default = null, boolean $first = true ) : string | array
$key string The header name
$default mixed The default value
$first boolean Whether to return the first value or all header values
리턴 string | array The first header value if $first is true, an array of values otherwise

getCacheControlDirective() 공개 메소드

Returns a Cache-Control directive value by name.
public getCacheControlDirective ( string $key ) : mixed | null
$key string The directive name
리턴 mixed | null The directive value if defined, null otherwise

getCacheControlHeader() 보호된 메소드

protected getCacheControlHeader ( )

getDate() 공개 메소드

Returns the HTTP header value converted to a date.
public getDate ( string $key, DateTime $default = null ) : null | DateTime
$key string The parameter key
$default DateTime The default value
리턴 null | DateTime The parsed DateTime or the default value if the header does not exist

getIterator() 공개 메소드

Returns an iterator for headers.
public getIterator ( ) : ArrayIterator
리턴 ArrayIterator An \ArrayIterator instance

has() 공개 메소드

Returns true if the HTTP header is defined.
public has ( string $key ) : boolean
$key string The HTTP header
리턴 boolean true if the parameter exists, false otherwise

hasCacheControlDirective() 공개 메소드

Returns true if the Cache-Control directive is defined.
public hasCacheControlDirective ( string $key ) : boolean
$key string The Cache-Control directive
리턴 boolean true if the directive exists, false otherwise

keys() 공개 메소드

Returns the parameter keys.
public keys ( ) : array
리턴 array An array of parameter keys

parseCacheControl() 보호된 메소드

Parses a Cache-Control HTTP header.
protected parseCacheControl ( string $header ) : array
$header string The value of the Cache-Control HTTP header
리턴 array An array representing the attribute values

remove() 공개 메소드

Removes a header.
public remove ( string $key )
$key string The HTTP header name

removeCacheControlDirective() 공개 메소드

Removes a Cache-Control directive.
public removeCacheControlDirective ( string $key )
$key string The Cache-Control directive

replace() 공개 메소드

Replaces the current HTTP headers by a new set.
public replace ( array $headers = [] )
$headers array An array of HTTP headers

set() 공개 메소드

Sets a header by name.
public set ( string $key, string | array $values, boolean $replace = true )
$key string The key
$values string | array The value or an array of values
$replace boolean Whether to replace the actual value or not (true by default)

프로퍼티 상세

$cacheControl 보호되어 있는 프로퍼티

protected $cacheControl

$headers 보호되어 있는 프로퍼티

protected $headers