WIP Coupon
Implementation CouponInterface 1st class : RemoveXAmount Implementation CouponRuleInterface 1st class : AvailableForTotalAmount
This commit is contained in:
54
core/lib/Thelia/Exception/InvalidRuleException.php
Normal file
54
core/lib/Thelia/Exception/InvalidRuleException.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**********************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/**********************************************************************************/
|
||||
|
||||
namespace Thelia\Exception;
|
||||
|
||||
use Thelia\Log\Tlog;
|
||||
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
* Date: 8/19/13
|
||||
* Time: 3:24 PM
|
||||
*
|
||||
* Thrown when a Rule is badly implemented
|
||||
*
|
||||
* @package Coupon
|
||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
class InvalidRuleException extends \RuntimeException
|
||||
{
|
||||
/**
|
||||
* InvalidRuleOperatorException thrown when a Rule is badly implemented
|
||||
*
|
||||
* @param string $className Class name
|
||||
* @param string $parameter array key parameter
|
||||
*/
|
||||
public function __construct($className) {
|
||||
|
||||
$message = 'Invalid Rule given to ' . $className;
|
||||
Tlog::getInstance()->addError($message);
|
||||
|
||||
parent::__construct($message);
|
||||
}
|
||||
}
|
||||
54
core/lib/Thelia/Exception/InvalidRuleOperatorException.php
Normal file
54
core/lib/Thelia/Exception/InvalidRuleOperatorException.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**********************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/**********************************************************************************/
|
||||
|
||||
namespace Thelia\Exception;
|
||||
|
||||
use Thelia\Log\Tlog;
|
||||
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
* Date: 8/19/13
|
||||
* Time: 3:24 PM
|
||||
*
|
||||
* Thrown when a Rule receive an invalid Operator
|
||||
*
|
||||
* @package Coupon
|
||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
class InvalidRuleOperatorException extends \RuntimeException
|
||||
{
|
||||
/**
|
||||
* InvalidRuleOperatorException thrown when a Rule is given a bad Operator
|
||||
*
|
||||
* @param string $className Class name
|
||||
* @param string $parameter array key parameter
|
||||
*/
|
||||
public function __construct($className, $parameter) {
|
||||
|
||||
$message = 'Invalid Operator for Rule ' . $className . ' on parameter ' . $parameter;
|
||||
Tlog::getInstance()->addError($message);
|
||||
|
||||
parent::__construct($message);
|
||||
}
|
||||
}
|
||||
54
core/lib/Thelia/Exception/InvalidRuleValueException.php
Normal file
54
core/lib/Thelia/Exception/InvalidRuleValueException.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**********************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/**********************************************************************************/
|
||||
|
||||
namespace Thelia\Exception;
|
||||
|
||||
use Thelia\Log\Tlog;
|
||||
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
* Date: 8/19/13
|
||||
* Time: 3:24 PM
|
||||
*
|
||||
* Thrown when a Rule receive an invalid Parameter
|
||||
*
|
||||
* @package Coupon
|
||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
class InvalidRuleValueException extends \RuntimeException
|
||||
{
|
||||
/**
|
||||
* InvalidRuleValueException thrown when a Rule is given a bad Parameter
|
||||
*
|
||||
* @param string $className Class name
|
||||
* @param string $parameter array key parameter
|
||||
*/
|
||||
public function __construct($className, $parameter) {
|
||||
|
||||
$message = 'Invalid Parameter for Rule ' . $className . ' on parameter ' . $parameter;
|
||||
Tlog::getInstance()->addError($message);
|
||||
|
||||
parent::__construct($message);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user