Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
FileExistenceResource example
public
function
fileExists
(
string
$path
, bool|string
$trackContents
= true
)
: bool
{
$exists
=
file_exists
(
$path
)
;
if
(
!
$this
->trackResources ||
$this
->
inVendors
(
$path
)
)
{
return
$exists
;
}
if
(
!
$exists
)
{
$this
->
addResource
(
new
FileExistenceResource
(
$path
)
)
;
return
$exists
;
}
if
(
is_dir
(
$path
)
)
{
if
(
$trackContents
)
{
$this
->
addResource
(
new
DirectoryResource
(
$path
, \
is_string
(
$trackContents
)
?
$trackContents
: null
)
)
;
}
else
{
$this
->
addResource
(
new
GlobResource
(
$path
, '/*', false
)
)
;
}
}
elseif
(
$trackContents
)
{