PictureHandler   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

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

2 Methods

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