discount_api
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class discount_api extends MY_Controller
{
/**
* __construct base object loaded
- Create a ticketCreate a ticket
Function getUserDiscount
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getUserDiscount($option = []) {
if (count($option) > 0) {
BaseDiscount::prepareOption($option);
}
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getDiscount
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function getDiscount($option = [], $typeReturn = null) {
if (count($option) > 0) {
BaseDiscount::prepareOption($option);
}
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method applyProductDiscount
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function applyProductDiscount() {
$productVariants = $this->db
->select('shop_product_variants.id as var_id, shop_product_variants.price as price, shop_products.id as id, shop_products.brand_id as brand_id, shop_products.category_id as category_id')
->from('shop_products')
- Create a ticketCreate a ticket
Method getDiscount
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getDiscount($option = [], $typeReturn = null) {
if (count($option) > 0) {
BaseDiscount::prepareOption($option);
}
- Create a ticketCreate a ticket
Function getDiscountBy
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getDiscountBy($key, $id) {
$this->baseDiscount = BaseDiscount::create();
foreach ($this->baseDiscount->allDiscount as $disc) {
switch ($key) {
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getDiscountProduct
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getDiscountProduct($product, $price = null) {
if (BaseDiscount::checkModuleInstall()) {
$DiscProdObj = Discount_product::create();
if ($DiscProdObj->getProductDiscount($product, $price)) {
$arr = assetManager::create()->discount;
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getGiftCertificate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getGiftCertificate($key = null, $totalPrice = null) {
$cart = BaseCart::getInstance();
$this->baseDiscount = BaseDiscount::create();
if ($totalPrice === null) {
$totalPrice = $cart->getTotalPrice();
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"