/** * @param NotePosition $notePositions * @param array $items */ public function checkNoteProducts(NotePosition $notePositions, array $items) { Helper::assertElementCount($notePositions, count($items)); $result = Helper::searchElements($items, $notePositions); if ($result !== true) { $messages = ['The following articles were not found:']; foreach ($result as $product) { $messages[] = $product['number'] . ' - ' . $product['name']; } Helper::throwException($messages); } }
/** * @param NotePosition $notePositions * @param array $items */ public function checkNoteProducts(NotePosition $notePositions, array $items) { if (count($notePositions) !== count($items)) { $message = sprintf('There are %d products on the note! (should be %d)', count($notePositions), count($items)); Helper::throwException($message); } $result = Helper::searchElements($items, $notePositions); if ($result !== true) { $messages = array('The following articles were not found:'); foreach ($result as $product) { $messages[] = $product['number'] . ' - ' . $product['name']; } Helper::throwException($messages); } }
/** * Checks the product comparison * Available properties are: image, name, ranking, description, price, link * * @param CompareColumn $compareColumns * @param array $items */ public function checkComparisonProducts(CompareColumn $compareColumns, array $items) { if (count($compareColumns) !== count($items)) { $message = sprintf('There are %d products in the comparison! (should be %d)', count($compareColumns), count($items)); Helper::throwException($message); } $result = Helper::searchElements($items, $compareColumns); if ($result !== true) { $messages = array('The following articles were not found:'); foreach ($result as $product) { $messages[] = $product['name']; } Helper::throwException($messages); } }
/** * Checks the product comparison * Available properties are: image, name, ranking, description, price, link * * @param CompareColumn $compareColumns * @param array $items */ public function checkComparisonProducts(CompareColumn $compareColumns, array $items) { Helper::assertElementCount($compareColumns, count($items)); $result = Helper::searchElements($items, $compareColumns); if ($result !== true) { $messages = ['The following articles were not found:']; foreach ($result as $product) { $messages[] = $product['name']; } Helper::throwException($messages); } }