mygento/simplepay

View on GitHub

Showing 8 of 8 total issues

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

    public function addTransaction($order_id)
    {
        $order = Mage::getModel('sales/order')->load($order_id);
        $this->addLog('TA: order #' . $order->getIncrementId());
        $orders = Mage::getModel('sales/order_invoice')->getCollection()
Severity: Minor
Found in app/code/community/Mygento/Simplepay/Helper/Data.php - About 1 hr to fix

    Function addTransaction has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        public function addTransaction($order_id)
        {
            $order = Mage::getModel('sales/order')->load($order_id);
            $this->addLog('TA: order #' . $order->getIncrementId());
            $orders = Mage::getModel('sales/order_invoice')->getCollection()
    Severity: Minor
    Found in app/code/community/Mygento/Simplepay/Helper/Data.php - About 1 hr to fix

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

        public function getFields($order)
        {
            $result = array();
    
            if (strpos($order->getPayment()->getMethodInstance()->getCode(), 'simplepay') !== false) {
    Severity: Minor
    Found in app/code/community/Mygento/Simplepay/Model/Abstract.php - About 1 hr to fix

      Method resultAction has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function resultAction()
          {
              if ($this->getRequest()->isPost()) {
                  $request = Mage::app()->getRequest()->getPost();
                  Mage::helper('simplepay')->addLog('---START OF RESULT POST---');

        Function getFields has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getFields($order)
            {
                $result = array();
        
                if (strpos($order->getPayment()->getMethodInstance()->getCode(), 'simplepay') !== false) {
        Severity: Minor
        Found in app/code/community/Mygento/Simplepay/Model/Abstract.php - About 1 hr to fix

        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 isEmailContext has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function isEmailContext()
            {
                $info = $this->getInfo();
                if ($info instanceof Mage_Sales_Model_Quote_Payment) {
                    return false;
        Severity: Minor
        Found in app/code/community/Mygento/Simplepay/Block/Info.php - About 1 hr to fix

        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 resultAction has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function resultAction()
            {
                if ($this->getRequest()->isPost()) {
                    $request = Mage::app()->getRequest()->getPost();
                    Mage::helper('simplepay')->addLog('---START OF RESULT POST---');

        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 paynowAction has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function paynowAction()
            {
                if (Mage::getStoreConfig('payment/simplepay/active')) {
                    $session = Mage::getSingleton('checkout/session');
                    //сессия
        Severity: Minor
        Found in app/code/community/Mygento/Simplepay/controllers/PaymentController.php - About 55 mins to fix

        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

        Severity
        Category
        Status
        Source
        Language