Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
FileAttributes example
$this
->files
[
$path
]
->
setVisibility
(
$visibility
)
;
}
public
function
visibility
(
string
$path
)
: FileAttributes
{
$path
=
$this
->
preparePath
(
$path
)
;
if
(
!\
array_key_exists
(
$path
,
$this
->files
)
)
{
throw
UnableToRetrieveMetadata::
visibility
(
$path
, 'file does not exist'
)
;
}
return
new
FileAttributes
(
$path
, null,
$this
->files
[
$path
]
->
visibility
(
)
)
;
}
public
function
mimeType
(
string
$path
)
: FileAttributes
{
$preparedPath
=
$this
->
preparePath
(
$path
)
;
if
(
!\
array_key_exists
(
$preparedPath
,
$this
->files
)
)
{
throw
UnableToRetrieveMetadata::
mimeType
(
$path
, 'file does not exist'
)
;
}
$mimeType
=
$this
->mimeTypeDetector->
detectMimeType
(
$path
,
$this
->files
[
$preparedPath
]
->
read
(
)
)
;
function
DStorageAttributes
$info
)
{
if
(
$info
instanceof DirectoryAttributes
)
{
return
new
DirectoryAttributes
(
$this
->
stripPath
(
$info
->
path
(
)
)
,
$info
->
visibility
(
)
,
$info
->
lastModified
(
)
,
$info
->
extraMetadata
(
)
)
;
}
if
(
$info
instanceof FileAttributes
)
{
return
new
FileAttributes
(
$this
->
stripPath
(
$info
->
path
(
)
)
,
$info
->
fileSize
(
)
,
$info
->
visibility
(
)
,
$info
->
lastModified
(
)
,
$info
->
mimeType
(
)
,
$info
->
extraMetadata
(
)
)
;
}
// @codeCoverageIgnoreStart
return
$info
;
// @codeCoverageIgnoreEnd