PHP 클래스 Neos\Flow\Http\Headers

파일 보기 프로젝트 열기: neos/flow-development-collection 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$cacheDirectives array
$cookies array
$fields array

공개 메소드들

메소드 설명
__construct ( array $fields = [] ) Constructs a new Headers object.
createFromServer ( array $server ) : Headers Creates a new Headers instance from the given $_SERVER-superglobal-like array.
eatCookie ( string $name ) : void Although not 100% semantically correct, an alias for removeCookie()
get ( string $name ) : array | string Returns the specified HTTP header
getAll ( ) : array Returns all header fields
getCacheControlDirective ( string $name ) : mixed Returns the value of the specified Cache-Control directive.
getCookie ( string $name ) : Cookie Returns a cookie specified by the given name
getCookies ( ) : array Returns all cookies
has ( string $name ) : boolean Checks if the specified HTTP header exists
hasCookie ( string $name ) : boolean Checks if the specified cookie exists
remove ( string $name ) : void Removes the specified header field
removeCacheControlDirective ( string $name ) : void Removes a special directive previously set for the Cache-Control header.
removeCookie ( string $name ) : void Removes the specified cookie if it exists
set ( string $name, array | string | DateTime $values, boolean $replaceExistingHeader = true ) : void Sets the specified HTTP header
setCacheControlDirective ( string $name, string $value = null ) : void Sets a special directive for use in the Cache-Control header, according to RFC 2616 / 14.9
setCookie ( Cookie $cookie ) : void Sets a cookie

보호된 메소드들

메소드 설명
getCacheControlHeader ( ) : string Renders and returns a Cache-Control header, based on the previously set cache control directives.
setCacheControlDirectivesFromRawHeader ( string $rawFieldValue ) : void Internally sets the cache directives correctly by parsing the given Cache-Control field value.
setCookiesFromRawHeader ( string $rawFieldValue ) : void Internally sets cookie objects based on the Cookie header field value.

메소드 상세

__construct() 공개 메소드

Constructs a new Headers object.
public __construct ( array $fields = [] )
$fields array Field names and their values (either as single value or array of values)

createFromServer() 공개 정적인 메소드

Creates a new Headers instance from the given $_SERVER-superglobal-like array.
public static createFromServer ( array $server ) : Headers
$server array An array similar or equal to $_SERVER, containing headers in the form of "HTTP_FOO_BAR"
리턴 Headers

eatCookie() 공개 메소드

Although not 100% semantically correct, an alias for removeCookie()
public eatCookie ( string $name ) : void
$name string Name of the cookie to eat
리턴 void

get() 공개 메소드

Dates are returned as DateTime objects with the timezone set to GMT.
public get ( string $name ) : array | string
$name string Name of the header, for example "Location", "Content-Description" etc.
리턴 array | string An array of field values if multiple headers of that name exist, a string value if only one value exists and NULL if there is no such header.

getAll() 공개 메소드

Note that even for those header fields which exist only one time, the value is returned as an array (with a single item).
public getAll ( ) : array
리턴 array

getCacheControlDirective() 공개 메소드

If the cache directive is not present, NULL is returned. If the specified directive is present but contains no value, this method returns TRUE. Finally, if the directive is present and does contain a value, the value is returned.
public getCacheControlDirective ( string $name ) : mixed
$name string Name of the cache directive, for example "max-age"
리턴 mixed

getCacheControlHeader() 보호된 메소드

Renders and returns a Cache-Control header, based on the previously set cache control directives.
또한 보기: get()
protected getCacheControlHeader ( ) : string
리턴 string Either the value of the header or NULL if it shall be omitted

getCookie() 공개 메소드

Returns a cookie specified by the given name
public getCookie ( string $name ) : Cookie
$name string Name of the cookie
리턴 Cookie The cookie or NULL if no such cookie exists

getCookies() 공개 메소드

Returns all cookies
public getCookies ( ) : array
리턴 array

has() 공개 메소드

Checks if the specified HTTP header exists
public has ( string $name ) : boolean
$name string Name of the header
리턴 boolean

hasCookie() 공개 메소드

Checks if the specified cookie exists
public hasCookie ( string $name ) : boolean
$name string Name of the cookie
리턴 boolean

remove() 공개 메소드

Removes the specified header field
public remove ( string $name ) : void
$name string Name of the field
리턴 void

removeCacheControlDirective() 공개 메소드

Removes a special directive previously set for the Cache-Control header.
public removeCacheControlDirective ( string $name ) : void
$name string Name of the directive, for example "public"
리턴 void

removeCookie() 공개 메소드

Note: This will remove the cookie object from this Headers container. If you intend to remove a cookie in the user agent (browser), you should call the cookie's expire() method and _not_ remove the cookie from the Headers container.
public removeCookie ( string $name ) : void
$name string Name of the cookie to remove
리턴 void

set() 공개 메소드

DateTime objects will be converted to a string representation internally but will be returned as DateTime objects on calling get(). Please note that dates are normalized to GMT internally, so that get() will return the same point in time, but not necessarily in the same timezone, if it was not GMT previously. GMT is used synonymously with UTC as per RFC 2616 3.3.1.
public set ( string $name, array | string | DateTime $values, boolean $replaceExistingHeader = true ) : void
$name string Name of the header, for example "Location", "Content-Description" etc.
$values array | string | DateTime An array of values or a single value for the specified header field
$replaceExistingHeader boolean If a header with the same name should be replaced. Default is TRUE.
리턴 void

setCacheControlDirective() 공개 메소드

Sets a special directive for use in the Cache-Control header, according to RFC 2616 / 14.9
public setCacheControlDirective ( string $name, string $value = null ) : void
$name string Name of the directive, for example "max-age"
$value string An optional value
리턴 void

setCacheControlDirectivesFromRawHeader() 보호된 메소드

Internally sets the cache directives correctly by parsing the given Cache-Control field value.
또한 보기: set()
protected setCacheControlDirectivesFromRawHeader ( string $rawFieldValue ) : void
$rawFieldValue string The value of a specification compliant Cache-Control header
리턴 void

setCookie() 공개 메소드

Sets a cookie
public setCookie ( Cookie $cookie ) : void
$cookie Cookie
리턴 void

setCookiesFromRawHeader() 보호된 메소드

Internally sets cookie objects based on the Cookie header field value.
또한 보기: set()
protected setCookiesFromRawHeader ( string $rawFieldValue ) : void
$rawFieldValue string The value of a specification compliant Cookie header
리턴 void

프로퍼티 상세

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

protected array $cacheDirectives
리턴 array

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

protected array $cookies
리턴 array

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

protected array $fields
리턴 array