detectPrefix($filename); if ($format->requiresPrefix()) { if ($detectedPrefix === null) { throw new DomainException('Missing prefix.'); } if (!in_array($detectedPrefix->toString(), $format->prefixes, true)) { throw new DomainException('Invalid prefix.'); } } else { if ($detectedPrefix !== null) { throw new DomainException('Non required prefix detected.'); } } }