DemacMedia/Magento-Multi-Location-Inventory

View on GitHub
app/code/community/Demac/MultiLocationInventory/Model/CatalogInventory/Observer.php

Summary

Maintainability
F
3 days
Test Coverage

Function checkQuoteItemQty has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkQuoteItemQty($observer)
    {
        $quoteItem = $observer->getEvent()->getItem();
        /* @var $quoteItem Mage_Sales_Model_Quote_Item */
        if(!$quoteItem || !$quoteItem->getProductId() || !$quoteItem->getQuote()

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 checkQuoteItemQty has 183 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function checkQuoteItemQty($observer)
    {
        $quoteItem = $observer->getEvent()->getItem();
        /* @var $quoteItem Mage_Sales_Model_Quote_Item */
        if(!$quoteItem || !$quoteItem->getProductId() || !$quoteItem->getQuote()

File Observer.php has 296 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Class Demac_MultiLocationInventory_Model_CatalogInventory_Observer
 */
class Demac_MultiLocationInventory_Model_CatalogInventory_Observer extends Mage_CatalogInventory_Model_Observer

Method refundOrderInventory has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function refundOrderInventory($observer)
    {
        /* @var $creditmemo Mage_Sales_Model_Order_Creditmemo */
        $creditmemo = $observer->getEvent()->getCreditmemo();
        $items      = array();

Method cancelOrderItem has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function cancelOrderItem($observer)
    {
        $item = $observer->getEvent()->getItem();

        $children = $item->getChildrenItems();

Function refundOrderInventory has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function refundOrderInventory($observer)
    {
        /* @var $creditmemo Mage_Sales_Model_Order_Creditmemo */
        $creditmemo = $observer->getEvent()->getCreditmemo();
        $items      = array();

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 _loopCancelItem has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function _loopCancelItem($args)
    {
        $productId = $args['product_id'];

        $row = $args['row'];

Function _loopCancelItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function _loopCancelItem($args)
    {
        $productId = $args['product_id'];

        $row = $args['row'];

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

There are no issues that match your filters.

Category
Status