class XmlPluginInfoReader{ public function read($file) { try { $dom = XmlUtils::
loadFile($file, __DIR__ . '/schema/plugin.xsd'
);
} catch (Exception
$e) { throw new InvalidArgumentException(sprintf('Unable to parse file "%s". Message: %s',
$file,
$e->
getMessage()),
$e->
getCode(),
$e);
} return $this->
parseInfo($dom);
} private function parseInfo(DOMDocument
$xml): ?array
{ $entries =
(new DOMXPath($xml))->
query('//plugin'
);
if (!
$entries instanceof DOMNodeList
) { return null;
} $entry =
$entries[0
];
$info =
[];