LinkHandler   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
c 0
b 0
f 0
dl 0
loc 24
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A cleanOrphan() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace XoopsModules\Tag;
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
 * XOOPS tag management module
17
 *
18
 * @copyright       {@link https://sourceforge.net/projects/xoops/ The XOOPS Project}
19
 * @license         {@link https://www.fsf.org/copyleft/gpl.html GNU public license}
20
 * @author          Taiwen Jiang <[email protected]>
21
 * @since           1.00
22
 */
23
24
/**
25
 * Tag link handler class.
26
 *
27
 * @author      Taiwen Jiang <[email protected]>
28
 * @copyright   copyright &copy; The XOOPS Project
29
 *
30
 * {@link XoopsPersistableObjectHandler}
31
 */
32
class LinkHandler extends \XoopsPersistableObjectHandler
33
{
34
    public $table_stats;
35
36
    /**
37
     * TagLinkHandler constructor.
38
     */
39
    public function __construct(\XoopsDatabase $db = null)
40
    {
41
        parent::__construct($db, 'tag_link', Link::class, 'tl_id', 'tag_itemid');
42
        $this->table_stats = $this->db->prefix('tag_stats');
43
    }
44
45
    /**
46
     * clean orphan links from database
47
     *
48
     * @param string $table_link
49
     * @param string $field_link
50
     * @param string $field_object
51
     * @return bool true on success
52
     */
53
    public function cleanOrphan($table_link = '', $field_link = '', $field_object = ''): bool
54
    {
55
        return parent::cleanOrphan($this->db->prefix('tag_tag'), 'tag_id');
56
    }
57
}
58