Commit 05d9bc30 authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

fix: empty string

parent a8a210e9
......@@ -825,19 +825,22 @@ class TEIToSolrImport implements ImporterInterface
private function getImageLicense(DOMXPath $xpath): string
{
$imageLicense = '';
$idno = $xpath->query('//tei:sourceDesc/tei:msDesc/tei:msIdentifier/tei:idno/text()');
if (str_starts_with($idno, "BBAW ")
): $imageLicense = "copyright";
elseif (str_starts_with($idno, "FDH ")
or str_starts_with($idno, "GSA ")
or str_starts_with($idno, "HU UA ")
): $imageLicense = "CC BY-NC-SA 4.0";
elseif (str_starts_with($idno, "GStA ")
or str_starts_with($idno, "HAAB ")
or str_starts_with($idno, "UAHW ")
): $imageLicense = "Public Domain Mark 1.0";
else: $imageLicense = "unregistered prefix in tei:idno";
$idno = $xpath->query('//tei:sourceDesc/tei:msDesc/tei:msIdentifier/tei:idno/descendant::text()');
if ($idno = ''):
$imageLicense = "xpath guides to empty string";
else:
if (str_starts_with($idno, "BBAW ")
): $imageLicense = "copyright";
elseif (str_starts_with($idno, "FDH ")
or str_starts_with($idno, "GSA ")
or str_starts_with($idno, "HU UA ")
): $imageLicense = "CC BY-NC-SA 4.0";
elseif (str_starts_with($idno, "GStA ")
or str_starts_with($idno, "HAAB ")
or str_starts_with($idno, "UAHW ")
): $imageLicense = "Public Domain Mark 1.0";
else: $imageLicense = "unregistered prefix in tei:idno";
endif;
endif;
return $imageLicense;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment