Completed
Push — master ( 80327c...27fe2c )
by Iurii
02:21
created

Image::info()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 0
1
<?php
2
3
/**
4
 * @package Image
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\image;
11
12
use gplcart\core\Module,
13
    gplcart\core\Library;
14
15
/**
16
 * Main class for Image module
17
 */
18
class Image extends Module
19
{
20
21
    /**
22
     * Library class instance
23
     * @var \gplcart\core\Library $library
24
     */
25
    protected $library;
26
27
    /**
28
     * @param Library $library
29
     */
30
    public function __construct(Library $library)
31
    {
32
        parent::__construct();
33
34
        $this->library = $library;
35
    }
36
37
    /**
38
     * Implements hook "library.list"
39
     * @param array $libraries
40
     */
41
    public function hookLibraryList(array &$libraries)
42
    {
43
        $libraries['simpleimage'] = array(
44
            'name' => 'SimpleImage',
45
            'description' => 'A PHP class that simplifies working with images',
46
            'type' => 'php',
47
            'module' => 'image',
48
            'url' => 'https://github.com/claviska/SimpleImage',
49
            'download' => 'https://github.com/claviska/SimpleImage/archive/3.3.0.zip',
50
            'version' => '3.3.0',
51
            'files' => array(
52
                'vendor/claviska/simpleimage/src/claviska/SimpleImage.php'
53
            )
54
        );
55
    }
56
57
    /**
58
     * Implements hook "imagestyle.action.handlers"
59
     * @param array $handlers
60
     */
61
    public function hookImagestyleActionHandlers(array &$handlers)
62
    {
63
        $config = include __DIR__ . '/config/actions.php';
64
        $handlers = array_merge($handlers, $config);
65
    }
66
67
    /**
68
     * Implements hook "module.enable.after"
69
     */
70
    public function hookModuleEnableAfter()
71
    {
72
        $this->library->clearCache();
73
    }
74
75
    /**
76
     * Implements hook "module.disable.after"
77
     */
78
    public function hookModuleDisableAfter()
79
    {
80
        $this->library->clearCache();
81
    }
82
83
    /**
84
     * Implements hook "module.install.after"
85
     */
86
    public function hookModuleInstallAfter()
87
    {
88
        $this->library->clearCache();
89
    }
90
91
    /**
92
     * Implements hook "module.uninstall.after"
93
     */
94
    public function hookModuleUninstallAfter()
95
    {
96
        $this->library->clearCache();
97
    }
98
99
}
100