Completed
Push — master ( ecebd4...e63933 )
by Iurii
01:18
created

Main::hookModuleEnableAfter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/**
4
 * @package Faker
5
 * @author Iurii Makukh <[email protected]>
6
 * @copyright Copyright (c) 2017, Iurii Makukh <[email protected]>
7
 * @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License 3.0
8
 */
9
10
namespace gplcart\modules\faker;
11
12
use gplcart\core\Module;
13
14
/**
15
 * Main class for Faker module
16
 */
17
class Main
18
{
19
20
    /**
21
     * Module class instance
22
     * @var \gplcart\core\Module $module
23
     */
24
    protected $module;
25
26
    /**
27
     * @param Module $module
28
     */
29
    public function __construct(Module $module)
30
    {
31
        $this->module = $module;
32
    }
33
34
    /**
35
     * Implements hook "library.list"
36
     * @param array $libraries
37
     */
38
    public function hookLibraryList(array &$libraries)
39
    {
40
        $libraries['faker'] = array(
41
            'name' => 'Faker',
42
            'description' => 'Faker is a PHP library that generates fake data for you',
43
            'url' => 'https://github.com/fzaninotto/Faker',
44
            'download' => 'https://github.com/fzaninotto/Faker/archive/v1.6.0.zip',
45
            'type' => 'php',
46
            'version' => '1.6.0',
47
            'module' => 'faker',
48
            'vendor' => 'fzaninotto/faker'
49
        );
50
    }
51
52
    /**
53
     * Implements hook "route.list"
54
     * @param mixed $routes
55
     */
56
    public function hookRouteList(&$routes)
57
    {
58
        $routes['admin/tool/faker'] = array(
59
            'menu' => array('admin' => 'Generate fake content'),
60
            'access' => 'module_faker_generate',
61
            'handlers' => array(
62
                'controller' => array('gplcart\\modules\\faker\\controllers\\Generator', 'editGenerator')
63
            )
64
        );
65
    }
66
67
    /**
68
     * Implements hook "user.role.permissions"
69
     * @param array $permissions
70
     */
71
    public function hookUserRolePermissions(array &$permissions)
72
    {
73
        $permissions['module_faker_generate'] = 'Faker: generate content';
74
    }
75
76
}
77