public function isValidUsingSimplePurchasableValidation(
		PurchasableInterface $purchasable,
		$stockRequired,
		$useStock
	) {

		if ($useStock) {
			if (!$purchasable->isEnabled() || $stockRequired <= 0 || ($useStock && $purchasable->getStock() <= 0)) {
				return false;
			}

			if ($purchasable->getStock() < $stockRequired) {
				return $purchasable->getStock();
			}
		}
		return true;
	}
public function isValidUsingSimplePurchasableValidation(
		PurchasableInterface $purchasable,
		$stockRequired,
		$useStock
	) {

		if ($useStock) {
			if (!$purchasable->isEnabled() || $stockRequired <= 0 || ($useStock && $purchasable->getStock() <= 0)) {
				return false;
			}

			if ($purchasable->getStock() < $stockRequired) {
				return $purchasable->getStock();
			}
		}
		return true;
	}
public function isValidUsingSimplePurchasableValidation ( PurchasableInterface $ purchasable , $ stockRequired , $ useStock ) { if ( $ useStock ) { if ( ! $ purchasable -> isEnabled ( ) || $ stockRequired <= 0 || ( $ useStock && $ purchasable -> getStock ( ) <= 0 ) ) { return false ; } if ( $ purchasable -> getStock ( ) < $ stockRequired ) { return $ purchasable -> getStock ( ) ; } } return true ; }
Make a simple validation of a Purchasable instance.

@param PurchasableInterface $purchasable   Purchasable
@param int                  $stockRequired Stock required
@param bool                 $useStock      Use stock

@return bool|int Is valid or the number of elements that can be used
Make a simple validation of a Purchasable instance .