/** * @param ReadInterface $file * @return array|bool * @throws LocalizedException */ private function getHeaders(ReadInterface $file) { // check and skip headers $headers = $file->readCsv(); if ($headers === false || count($headers) < 5) { throw new LocalizedException(__('Please correct Table Rates File Format.')); } return $headers; }