. */ /* */ /*************************************************************************************/ namespace Thelia\Coupon; use Symfony\Component\Intl\Exception\NotImplementedException; /** * Created by JetBrains PhpStorm. * Date: 8/19/13 * Time: 3:24 PM * * Assist in writing a CouponInterface * * @package Coupon * @author Guillaume MOREL * */ abstract class CouponAbstract implements CouponInterface { /** @var CouponAdapterInterface Provide necessary value from Thelia*/ protected $adapter; /** @var RuleOrganizerInterface */ protected $organizer = null; /** @var string Coupon code (ex: XMAS) */ protected $code = null; /** @var string Coupon title (ex: Coupon for XMAS) */ protected $title = null; /** @var string Coupon short description */ protected $shortDescription = null; /** @var string Coupon description */ protected $description = null; /** @var bool if Coupon is cumulative */ protected $isCumulative = false; /** @var bool if Coupon is removing postage */ protected $isRemovingPostage = false; /** * Set Adapter containing all relevant data * * @param CouponAdapterInterface $adapter Adapter * * @return $this */ public function setAdapter($adapter) { $this->adapter = $adapter; return $this; } /** * Set Rule Organizer * * @param RuleOrganizerInterface $organizer Manage Rule groups (&& and ||) * * @return $this */ public function setOrganizer($organizer) { $this->organizer = $organizer; return $this; } /** * Return Coupon code (ex: XMAS) * * @return string */ public function getCode() { return $this->code; } /** * Return Coupon title (ex: Coupon for XMAS) * * @return string */ public function getTitle() { return $this->title; } /** * Return Coupon short description * * @return string */ public function getShortDescription() { return $this->shortDescription; } /** * Return Coupon description * * @return string */ public function getDescription() { return $this->description; } /** * If Coupon is cumulative or prevent any accumulation * If is cumulative you can sum Coupon effects * If not cancel all other Coupon and take the last given * * @return bool */ public function isCumulative() { return $this->isCumulative; } /** * If Coupon is removing Checkout Postage * * @return bool */ public function isRemovingPostage() { return $this->isRemovingPostage; } /** * Return effects generated by the coupon * * @throws \Symfony\Component\Intl\Exception\NotImplementedException * @return \Closure */ public function getEffect() { throw new NotImplementedException( 'Abstract method to implement (CouponAbstract->getEffect)' ); } }