Main   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 58
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A hookRouteList() 0 19 1
A hookCronRunAfter() 0 4 1
A hookUserRolePermissions() 0 4 1
A hookJobHandlers() 0 8 1
1
<?php
2
3
/**
4
 * @package Importer
5
 * @author Iurii Makukh
6
 * @copyright Copyright (c) 2017, Iurii Makukh
7
 * @license https://www.gnu.org/licenses/gpl-3.0.en.html GPL-3.0+
8
 */
9
10
namespace gplcart\modules\import;
11
12
/**
13
 * Main class for Importer module
14
 */
15
class Main
16
{
17
18
    /**
19
     * Implements hook "route.list"
20
     * @param mixed $routes
21
     */
22
    public function hookRouteList(&$routes)
23
    {
24
        $routes['admin/module/settings/import'] = array(
25
            'access' => 'module_edit',
26
            'handlers' => array(
27
                'controller' => array('gplcart\\modules\\import\\controllers\\Settings', 'editSettings')
28
            )
29
        );
30
31
        $routes['admin/tool/import'] = array(
32
            'menu' => array(
33
                'admin' => 'Import' // @text
34
            ),
35
            'access' => 'import_product',
36
            'handlers' => array(
37
                'controller' => array('gplcart\\modules\\import\\controllers\\Import', 'doImport')
38
            )
39
        );
40
    }
41
42
    /**
43
     * Implements hook "hook.cron"
44
     */
45
    public function hookCronRunAfter()
46
    {
47
        gplcart_file_empty(gplcart_file_private_module('import'), array('csv'), 24 * 60 * 60);
48
    }
49
50
    /**
51
     * Implements hook "user.role.permissions"
52
     * @param array $permissions
53
     */
54
    public function hookUserRolePermissions(array &$permissions)
55
    {
56
        $permissions['import_product'] = 'Importer: import products'; // @text
57
    }
58
59
    /**
60
     * Implements hook "job.handlers"
61
     * @param mixed $handlers
62
     */
63
    public function hookJobHandlers(array &$handlers)
64
    {
65
        $handlers['import_product'] = array(
66
            'handlers' => array(
67
                'process' => array('gplcart\\modules\\import\\handlers\\Import', 'process')
68
            ),
69
        );
70
    }
71
72
}
73