/home/sharedstore/public_html/prestashop.sharedstore.ma/src/Adapter/Shop/Url
Edit: /home/sharedstore/public_html/prestashop.sharedstore.ma/src/Adapter/Shop/Url/ProductProvider.php (1872B)
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
declare(strict_types=1);
namespace PrestaShop\PrestaShop\Adapter\Shop\Url;
use Link;
use PrestaShop\PrestaShop\Core\Shop\Url\UrlProviderInterface;
/**
* Class ProductProvider provides base Front Office URL for context shop.
*/
class ProductProvider implements UrlProviderInterface
{
/**
* @var Link
*/
private $link;
/**
* @param Link $link
*/
public function __construct(Link $link)
{
$this->link = $link;
}
/**
* Create a link to a product.
*
* @param int|null $productId
* @param string|null $rewrite
*
* @return string
*/
public function getUrl(?int $productId = null, ?string $rewrite = null): string
{
return $this->link->getProductLink((int) $productId, $rewrite);
}
}