Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
toSeconds example
if
(
isset
(
$this
->etags
[
$request
]
)
&& !
$response
->headers->
has
(
'Etag'
)
)
{
$response
->
setEtag
(
$this
->etags
[
$request
]
)
;
}
unset
(
$this
->lastModified
[
$request
]
)
;
unset
(
$this
->etags
[
$request
]
)
;
$hasVary
=
$response
->headers->
has
(
'Vary'
)
;
foreach
(
array_reverse
(
$attributes
)
as
$cache
)
{
if
(
null !==
$cache
->smaxage && !
$response
->headers->
hasCacheControlDirective
(
's-maxage'
)
)
{
$response
->
setSharedMaxAge
(
$this
->
toSeconds
(
$cache
->smaxage
)
)
;
}
if
(
$cache
->mustRevalidate
)
{
$response
->headers->
addCacheControlDirective
(
'must-revalidate'
)
;
}
if
(
null !==
$cache
->maxage && !
$response
->headers->
hasCacheControlDirective
(
'max-age'
)
)
{
$response
->
setMaxAge
(
$this
->
toSeconds
(
$cache
->maxage
)
)
;
}
if
(
null !==
$cache
->maxStale && !
$response
->headers->
hasCacheControlDirective
(
'max-stale'
)
)
{
if
(
isset
(
$this
->etags
[
$request
]
)
&& !
$response
->headers->
has
(
'Etag'
)
)
{
$response
->
setEtag
(
$this
->etags
[
$request
]
)
;
}
unset
(
$this
->lastModified
[
$request
]
)
;
unset
(
$this
->etags
[
$request
]
)
;
$hasVary
=
$response
->headers->
has
(
'Vary'
)
;
foreach
(
array_reverse
(
$attributes
)
as
$cache
)
{
if
(
null !==
$cache
->smaxage && !
$response
->headers->
hasCacheControlDirective
(
's-maxage'
)
)
{
$response
->
setSharedMaxAge
(
$this
->
toSeconds
(
$cache
->smaxage
)
)
;
}
if
(
$cache
->mustRevalidate
)
{
$response
->headers->
addCacheControlDirective
(
'must-revalidate'
)
;
}
if
(
null !==
$cache
->maxage && !
$response
->headers->
hasCacheControlDirective
(
'max-age'
)
)
{
$response
->
setMaxAge
(
$this
->
toSeconds
(
$cache
->maxage
)
)
;
}
if
(
null !==
$cache
->maxStale && !
$response
->headers->
hasCacheControlDirective
(
'max-stale'
)
)
{