for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
/**
* File: Product.php
*
* @author Maciej Sławik <[email protected]>
* Github: https://github.com/maciejslawik
*/
namespace MSlwk\CatalogMode\Plugin\Catalog\Model;
use Magento\Catalog\Model\Product as ProductModel;
use MSlwk\CatalogMode\Api\CatalogModeConfigProviderInterface;
* Class Product
* @package MSlwk\CatalogMode\Plugin\Catalog\Model
class Product
{
* @var CatalogModeConfigProviderInterface
private $catalogModeConfigProvider;
* Product constructor.
* @param CatalogModeConfigProviderInterface $catalogModeConfigProvider
public function __construct(CatalogModeConfigProviderInterface $catalogModeConfigProvider)
$this->catalogModeConfigProvider = $catalogModeConfigProvider;
}
* @param ProductModel $subject
* @param bool $result
* @return bool
public function afterIsSalable(ProductModel $subject, bool $result)
$subject
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
return $this->catalogModeConfigProvider->isCatalogMode() ? false : $result;
public function afterGetIsSalable(ProductModel $subject, bool $result)
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.