Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
extractFromDirectory example
if
(
is_iterable
(
$resource
)
)
{
$files
=
[
]
;
foreach
(
$resource
as
$file
)
{
if
(
$this
->
canBeExtracted
(
$file
)
)
{
$files
[
]
=
$this
->
toSplFileInfo
(
$file
)
;
}
}
}
elseif
(
is_file
(
$resource
)
)
{
$files
=
$this
->
canBeExtracted
(
$resource
)
?
[
$this
->
toSplFileInfo
(
$resource
)
]
:
[
]
;
}
else
{
$files
=
$this
->
extractFromDirectory
(
$resource
)
;
}
return
$files
;
}
private
function
toSplFileInfo
(
string
$file
)
: \SplFileInfo
{
return
new
\
SplFileInfo
(
$file
)
;
}
/** * @throws InvalidArgumentException */