Passed
Push — master ( 827974...c305a5 )
by Michael
04:03
created

PictureHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
dl 0
loc 31
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 6 1
A __construct() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace XoopsModules\Adslight;
6
7
/*
8
 You may not change or alter any portion of this comment or credits
9
 of supporting developers from this source code or any supporting source code
10
 which is considered copyrighted (c) material of the original comment or credit authors.
11
 
12
 This program is distributed in the hope that it will be useful,
13
 but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
*/
16
17
/**
18
 * Module: Adslight
19
 *
20
 * @category        Module
21
 * @author          XOOPS Development Team <https://xoops.org>
22
 * @copyright       {@link https://xoops.org/ XOOPS Project}
23
 * @license         GPL 2.0 or later
24
 */
25
26
$moduleDirName = \basename(\dirname(__DIR__));
27
28
$permHelper = new \Xmf\Module\Helper\Permission();
29
30
/**
31
 * Class PicturesHandler
32
 */
33
class PictureHandler extends \XoopsPersistableObjectHandler
34
{
35
    /**
36
     * @var Helper
37
     */
38
    public $helper;
39
40
    /**
41
     * Constructor
42
     * @param null|\XoopsDatabase                $db
43
     * @param null|\XoopsModules\Adslight\Helper $helper
44
     */
45
46
    public function __construct(\XoopsDatabase $db = null, $helper = null)
47
    {
48
        /** @var \XoopsModules\Adslight\Helper $this- >helper */
49
        $this->helper = $helper;
50
        parent::__construct($db, 'adslight_pictures', Picture::class, 'cod_img', 'title');
51
    }
52
53
    /**
54
     * @param bool $isNew
55
     *
56
     * @return \XoopsObject
57
     */
58
    public function create($isNew = true)
59
    {
60
        $obj         = parent::create($isNew);
61
        $obj->helper = $this->helper;
62
63
        return $obj;
64
    }
65
}
66