Checks if the definition is inlineable.
ContainerBuilder $container:
string $id:
Definition $definition:
Boolean If the definition is inlineable
private function isInlineableDefinition(ContainerBuilder $container, $id, Definition $definition) {
if (ContainerInterface::SCOPE_PROTOTYPE === $definition
->getScope()) {
return true;
}
if ($definition
->isPublic()) {
return false;
}
if (!$this->graph
->hasNode($id)) {
return true;
}
$ids = array();
foreach ($this->graph
->getNode($id)
->getInEdges() as $edge) {
$ids[] = $edge
->getSourceNode()
->getId();
}
if (count(array_unique($ids)) > 1) {
return false;
}
return $container
->getDefinition(reset($ids))
->getScope() === $definition
->getScope();
}