Mygento_Payture_Model_Cron::fivemin()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 10

Duplication

Lines 13
Ratio 100 %

Importance

Changes 0
Metric Value
dl 13
loc 13
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
13 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...
14
    {
15
        Mage::helper('payture')->addLog('Start of cron run');
16
        $collection = Mage::getModel('payture/keys')->getCollection();
17
        $collection->addFieldToFilter('sessionid', array('neq' => null));
18
        $collection->addFieldToFilter('state', array('neq' => 'Complete'));
19
        $collection->addFieldToFilter('date', array('gteq' => Mage::getModel('core/date')->date('Y-m-d H:i:s', strtotime('-1 hour', time()))));
20
        Mage::helper('payture')->addLog('Checking ' . count($collection) . ' order tickets');
21
        foreach ($collection as $_ticket) {
22
            Mage::helper('payture')->checkTicket($_ticket);
23
        }
24
        Mage::helper('payture')->addLog('End of cron run');
25
    }
26
27 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...
28
    {
29
        Mage::helper('payture')->addLog('Start of cron run');
30
        $collection = Mage::getModel('payture/keys')->getCollection();
31
        $collection->addFieldToFilter('sessionid', array('neq' => null));
32
        $collection->addFieldToFilter('state', array('eq' => 'Authorized'));
33
        $collection->addFieldToFilter('date', array('gteq' => Mage::getModel('core/date')->date('Y-m-d H:i:s', strtotime('-48 hours', time()))));
34
        Mage::helper('payture')->addLog('Checking ' . count($collection) . ' authorized tickets');
35
        foreach ($collection as $_ticket) {
36
            Mage::helper('payture')->checkTicket($_ticket);
37
        }
38
        Mage::helper('payture')->addLog('End of cron run');
39
    }
40
}
41