Completed
Push — master ( bcac2c...7e9265 )
by Iurii
03:47
created

Module   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A hookRouteList() 0 17 1
A hookJobHandlers() 0 8 1
A hookUserRolePermissions() 0 4 1
A hookCron() 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 Module
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('admin' => /* @text */'Export'),
33
            'access' => 'export_product',
34
            'handlers' => array(
35
                'controller' => array('gplcart\\modules\\export\\controllers\\Export', 'doExport')
36
            )
37
        );
38
    }
39
40
    /**
41
     * Implements hook "job.handlers"
42
     * @param array $handlers
43
     */
44
    public function hookJobHandlers(array &$handlers)
45
    {
46
        $handlers['export_product'] = array(
47
            'handlers' => array(
48
                'process' => array('gplcart\\modules\\export\\handlers\\Export', 'process')
49
            ),
50
        );
51
    }
52
53
    /**
54
     * Implements hook "user.role.permissions"
55
     * @param array $permissions
56
     */
57
    public function hookUserRolePermissions(array &$permissions)
58
    {
59
        $permissions['export_product'] = /* @text */'Exporter: export products';
60
    }
61
62
    /**
63
     * Implements hook "cron"
64
     */
65
    public function hookCron()
66
    {
67
        gplcart_file_empty(gplcart_file_private_module('export'), array('csv'), 24 * 60 * 60);
68
    }
69
70
}
71