Block/Recommended/Wishlistproducts.php
private function getRecommendedProduct($productModel, $mode)
    {
        //array of products to display
        $products = [];
        switch ($mode) {
            case 'related':
                $products = $productModel->getRelatedProductIds();
                break;
            case 'upsell':
                $products = $productModel->getUpSellProductIds();
                break;
            case 'crosssell':
                $products = $productModel->getCrossSellProductIds();
                break;
        }

        return $products;
    }
private function getRecommendedProduct($productModel, $mode)
    {
        //array of products to display
        $products = [];
        switch ($mode) {
            case 'related':
                $products = $productModel->getRelatedProductIds();
                break;
            case 'upsell':
                $products = $productModel->getUpSellProductIds();
                break;
            case 'crosssell':
                $products = $productModel->getCrossSellProductIds();
                break;
        }

        return $products;
    }
private function getRecommendedProduct ( $ productModel , $ mode ) { //array of products to display $ products = [ ] ; switch ( $ mode ) { case 'related' : $ products = $ productModel -> getRelatedProductIds ( ) ; break ; case 'upsell' : $ products = $ productModel -> getUpSellProductIds ( ) ; break ; case 'crosssell' : $ products = $ productModel -> getCrossSellProductIds ( ) ; break ; } return $ products ; }
Product related items.

@param \Magento\Catalog\Model\Product $productModel
@param string $mode

@return array
Product related items .