if (stristr($_row, $last_row_before_contents) || $_row == $last_row_before_contents) { $status = CONTENTS; } else { if (stristr($_row, $subject_start)) { $Offer->setSubject(str_replace('Sagsnavn:', '', $_row)); } } } break; case CONTENTS: // Check if the products have ended // otherwise parse the prodct data if ($_row == $contents_end) { $current_page++; $status = MEGAMEDIA_ADDRESS; $Offer->setMaxPages((int) $pageArr[0]); } else { if (!stristr($_row, ' Bilag s. ')) { continue; } $product = explode(' Bilag s. ', $_row); if (sizeof($product) != 2) { throw new RuntimeException(sprintf('Could not parse product "%s"', $_row)); } $Product = new OfferProduct(); $Product->setNumber($product[0]); $pageArr = explode(' ', $product[1]); $Product->setPage((int) $pageArr[0]); $Product->setName($pageArr); $Offer->addProduct($Product, $pageArr[0]); }