Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
isSingleUsePrivateNode example
private
function
analyzeReferences
(
)
: void
{
(
new
AnalyzeServiceReferencesPass
(
false,
$this
->hasProxyDumper
)
)
->
process
(
$this
->container
)
;
$checkedNodes
=
[
]
;
$this
->circularReferences =
[
]
;
$this
->singleUsePrivateIds =
[
]
;
foreach
(
$this
->container->
getCompiler
(
)
->
getServiceReferenceGraph
(
)
->
getNodes
(
)
as
$id
=>
$node
)
{
if
(
!
$node
->
getValue
(
)
instanceof Definition
)
{
continue
;
}
if
(
$this
->
isSingleUsePrivateNode
(
$node
)
)
{
$this
->singleUsePrivateIds
[
$id
]
=
$id
;
}
$this
->
collectCircularReferences
(
$id
,
$node
->
getOutEdges
(
)
,
$checkedNodes
)
;
}
$this
->container->
getCompiler
(
)
->
getServiceReferenceGraph
(
)
->
clear
(
)
;
$this
->singleUsePrivateIds =
array_diff_key
(
$this
->singleUsePrivateIds,
$this
->circularReferences
)
;
}
private
function
collectCircularReferences
(
string
$sourceId
, array
$edges
, array &
$checkedNodes
, array &
$loops
=
[
]
, array
$path
=
[
]
, bool
$byConstructor
= true
)
: void
{
private
function
analyzeReferences
(
)
: void
{
(
new
AnalyzeServiceReferencesPass
(
false,
$this
->hasProxyDumper
)
)
->
process
(
$this
->container
)
;
$checkedNodes
=
[
]
;
$this
->circularReferences =
[
]
;
$this
->singleUsePrivateIds =
[
]
;
foreach
(
$this
->container->
getCompiler
(
)
->
getServiceReferenceGraph
(
)
->
getNodes
(
)
as
$id
=>
$node
)
{
if
(
!
$node
->
getValue
(
)
instanceof Definition
)
{
continue
;
}
if
(
$this
->
isSingleUsePrivateNode
(
$node
)
)
{
$this
->singleUsePrivateIds
[
$id
]
=
$id
;
}
$this
->
collectCircularReferences
(
$id
,
$node
->
getOutEdges
(
)
,
$checkedNodes
)
;
}
$this
->container->
getCompiler
(
)
->
getServiceReferenceGraph
(
)
->
clear
(
)
;
$this
->singleUsePrivateIds =
array_diff_key
(
$this
->singleUsePrivateIds,
$this
->circularReferences
)
;
}
private
function
collectCircularReferences
(
string
$sourceId
, array
$edges
, array &
$checkedNodes
, array &
$loops
=
[
]
, array
$path
=
[
]
, bool
$byConstructor
= true
)
: void
{
private
function
analyzeReferences
(
)
{
(
new
AnalyzeServiceReferencesPass
(
false, !
$this
->
getProxyDumper
(
)
instanceof NullDumper
)
)
->
process
(
$this
->container
)
;
$checkedNodes
=
[
]
;
$this
->circularReferences =
[
]
;
$this
->singleUsePrivateIds =
[
]
;
foreach
(
$this
->container->
getCompiler
(
)
->
getServiceReferenceGraph
(
)
->
getNodes
(
)
as
$id
=>
$node
)
{
if
(
!
$node
->
getValue
(
)
instanceof Definition
)
{
continue
;
}
if
(
$this
->
isSingleUsePrivateNode
(
$node
)
)
{
$this
->singleUsePrivateIds
[
$id
]
=
$id
;
}
$this
->
collectCircularReferences
(
$id
,
$node
->
getOutEdges
(
)
,
$checkedNodes
)
;
}
$this
->container->
getCompiler
(
)
->
getServiceReferenceGraph
(
)
->
clear
(
)
;
$this
->singleUsePrivateIds =
array_diff_key
(
$this
->singleUsePrivateIds,
$this
->circularReferences
)
;
}
private
function
collectCircularReferences
(
string
$sourceId
, array
$edges
, array &
$checkedNodes
, array &
$loops
=
[
]
, array
$path
=
[
]
, bool
$byConstructor
= true
)
: void
{