public function validateSchema(\DOMDocument
$dom): bool
{ $schemaLocations =
['http://symfony.com/schema/dic/services' =>
str_replace('\\', '/', __DIR__.'/schema/dic/services/services-1.0.xsd'
)];
if ($element =
$dom->documentElement->
getAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'schemaLocation'
)) { $items =
preg_split('/\s+/',
$element);
for ($i = 0,
$nb = \
count($items);
$i <
$nb;
$i += 2
) { if (!
$this->container->
hasExtension($items[$i])) { continue;
} if (($extension =
$this->container->
getExtension($items[$i])) && false !==
$extension->
getXsdValidationBasePath()) { $ns =
$extension->
getNamespace();
$path =
str_replace([$ns,
str_replace('http://', 'https://',
$ns)],
str_replace('\\', '/',
$extension->
getXsdValidationBasePath()).'/',
$items[$i + 1
]);
if (!
is_file($path)) { throw new RuntimeException(sprintf('Extension "%s" references a non-existent XSD file "%s".',
get_debug_type($extension),
$path));
} $schemaLocations[$items[$i]] =
$path;
} } }