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 hookJobHandlers() 0 8 1
A hookUserRolePermissions() 0 4 1
A hookCronRunAfter() 0 4 1
1
<?php
2
3
/**
4
 * @package Exporter
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\export;
11
12
/**
13
 * Main class for Exporter module
14
 */
15
class Main
16
{
17
18
    /**
19
     * Implements hook "route.list"
20
     * @param array $routes
21
     */
22
    public function hookRouteList(array &$routes)
23
    {
24
        $routes['admin/module/settings/export'] = array(
25
            'access' => 'module_edit',
26
            'handlers' => array(
27
                'controller' => array('gplcart\\modules\\export\\controllers\\Settings', 'editSettings')
28
            )
29
        );
30
31
        $routes['admin/tool/export'] = array(
32
            'menu' => array(
33
                'admin' => 'Export' // @text
34
            ),
35
            'access' => 'export_product',
36
            'handlers' => array(
37
                'controller' => array('gplcart\\modules\\export\\controllers\\Export', 'doExport')
38
            )
39
        );
40
    }
41
42
    /**
43
     * Implements hook "job.handlers"
44
     * @param array $handlers
45
     */
46
    public function hookJobHandlers(array &$handlers)
47
    {
48
        $handlers['export_product'] = array(
49
            'handlers' => array(
50
                'process' => array('gplcart\\modules\\export\\handlers\\Export', 'process')
51
            ),
52
        );
53
    }
54
55
    /**
56
     * Implements hook "user.role.permissions"
57
     * @param array $permissions
58
     */
59
    public function hookUserRolePermissions(array &$permissions)
60
    {
61
        $permissions['export_product'] = 'Exporter: export products'; // @text
62
    }
63
64
    /**
65
     * Implements hook "cron.run.after"
66
     */
67
    public function hookCronRunAfter()
68
    {
69
        gplcart_file_empty(gplcart_file_private_module('export'), array('csv'), 24 * 60 * 60);
70
    }
71
72
}
73