public static function fileToDatabase($file,
$options) { // Add the default values to the options array.
$options +=
[ 'overwrite_options' =>
[],
'customized' => LOCALE_NOT_CUSTOMIZED,
'items' => -1,
'seek' => 0,
];
// Instantiate and initialize the stream reader for this file.
$reader =
new PoStreamReader();
$reader->
setLangcode($file->langcode
);
$reader->
setURI($file->uri
);
try { $reader->
open();
} catch (\Exception
$exception) { throw $exception;
} $header =
$reader->
getHeader();
if (!
$header) { throw new \
Exception('Missing or malformed header.'
);
}