$expectedFilenamePattern =
$this->requireStrictFileNames ?
sprintf('/^.*\.(?i:%s)\.(?:xlf|xliff)/',
$normalizedLocalePattern) :
sprintf('/^(?:.*\.(?i:%s)|(?i:%s)\..*)\.(?:xlf|xliff)/',
$normalizedLocalePattern,
$normalizedLocalePattern);
if (0 ===
preg_match($expectedFilenamePattern,
basename($file))) { $errors[] =
[ 'line' => -1,
'column' => -1,
'message' =>
sprintf('There is a mismatch between the language included in the file name ("%s") and the "%s" value used in the "target-language" attribute of the file.',
basename($file),
$targetLanguage),
];
} } foreach (XliffUtils::
validateSchema($document) as $xmlError) { $errors[] =
[ 'line' =>
$xmlError['line'
],
'column' =>
$xmlError['column'
],
'message' =>
$xmlError['message'
],
];
} libxml_clear_errors();
libxml_use_internal_errors($internal);
return ['file' =>
$file, 'valid' => 0 === \
count($errors), 'messages' =>
$errors];
}