N°8772 - cleanup code

This commit is contained in:
Eric Espie
2025-10-30 14:24:09 +01:00
parent 601cde0e2d
commit 0df54413b3
23 changed files with 183 additions and 150 deletions

View File

@@ -15,24 +15,25 @@ use Symfony\Component\Filesystem\Exception\IOException;
*/
class OqlToClassConverter extends AbstractConverter
{
/** @inheritdoc */
/** @inheritdoc */
public function Convert(mixed $oData): ?ClassIOFormat
{
if($oData === null)
if ($oData === null) {
return null;
}
// Extract OQL information
preg_match('/SELECT\s+(\w+)/', $oData, $aMatches);
// Selected class
if(isset($aMatches[1])){
if (isset($aMatches[1])) {
$sSelectedClass = $aMatches[1];
if(!MetaModel::IsValidClass($sSelectedClass)){
throw new IOException('Incorrect OQL select class name ' . $sSelectedClass);
if (!MetaModel::IsValidClass($sSelectedClass)) {
throw new IOException('Incorrect OQL select class name '.$sSelectedClass);
}
return new ClassIOFormat($aMatches[1]);
}
else{
} else {
throw new IOException('Incorrect OQL sentence');
}