Completed
Push — master ( 863106...2b3bf6 )
by Danila
03:12
created

Mygento_Payture_Model_Cron::completeOrders()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 10

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
dl 12
loc 12
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 10
nc 2
nop 0
1
<?php
2
3
/**
4
 *
5
 *
6
 * @category Mygento
7
 * @package Mygento_Payture
8
 * @copyright Copyright © 2017 NKS LLC. (http://www.mygento.ru)
9
 */
10
class Mygento_Payture_Model_Cron {
11
12 View Code Duplication
    public function fivemin() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
        Mage::helper('payture')->addLog('Start of cron run');
14
        $collection = Mage::getModel('payture/keys')->getCollection();
15
        $collection->addFieldToFilter('sessionid', array('neq' => null));
16
        $collection->addFieldToFilter('state', array('neq' => 'Complete'));
17
        $collection->addFieldToFilter('date', array('gteq' => Mage::getModel('core/date')->date('Y-m-d H:i:s', strtotime('-1 hour', time()))));
18
        Mage::helper('payture')->addLog('Checking ' . count($collection) . ' order tickets');
19
        foreach ($collection as $_ticket) {
20
            Mage::helper('payture')->checkTicket($_ticket);
21
        }
22
        Mage::helper('payture')->addLog('End of cron run');
23
    }
24
25 View Code Duplication
    public function completeOrders() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
26
        Mage::helper('payture')->addLog('Start of cron run');
27
        $collection = Mage::getModel('payture/keys')->getCollection();
28
        $collection->addFieldToFilter('sessionid ', array('neq' => null));
29
        $collection->addFieldToFilter('state', array('eq' => 'Authorized'));
30
        $collection->addFieldToFilter('date', array('gteq' => Mage::getModel('core/date')->date('Y-m-d H:i:s', strtotime('48 hours', time()))));
31
        Mage::helper('payture')->addLog('Checking ' . count($collection) . ' authorized tickets');
32
        foreach ($collection as $_ticket) {
33
            Mage::helper('payture')->checkTicket($_ticket);
34
        }
35
        Mage::helper('payture')->addLog('End of cron run');
36
    }
37
38
}
39