src/ProductRepository.php
public function getProducts()
    {
        try {

            // read product data from storage
            $productDataArray = $this->productStorage->read();

            // deserialize the product data
            $products = [];
            foreach ($productDataArray as $productData) {
                $products[] = $this->productMapper->getProduct($productData);
            }

            return $products;

        } catch (\Exception $readException) {
            throw new RepositoryException("Failed to read products from storage provider.", $readException);
        }
    }
public function getProducts()
    {
        try {

            // read product data from storage
            $productDataArray = $this->productStorage->read();

            // deserialize the product data
            $products = [];
            foreach ($productDataArray as $productData) {
                $products[] = $this->productMapper->getProduct($productData);
            }

            return $products;

        } catch (\Exception $readException) {
            throw new RepositoryException("Failed to read products from storage provider.", $readException);
        }
    }
Get all products

@return Product[]

@throws RepositoryException If fetching the products failed