references_handler   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A getInstance() 0 9 2
1
<?php
2
/**
3
 * ****************************************************************************
4
 * references - MODULE FOR XOOPS
5
 * Copyright (c) Hervé Thouzard of Instant Zero (http://www.instant-zero.com)
6
 *
7
 * You may not change or alter any portion of this comment or credits
8
 * of supporting developers from this source code or any supporting source code
9
 * which is considered copyrighted (c) material of the original comment or credit authors.
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
 * @copyright       Hervé Thouzard of Instant Zero (http://www.instant-zero.com)
15
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
16
 * @package         references
17
 * @author          Hervé Thouzard of Instant Zero (http://www.instant-zero.com)
18
 *
19
 * ****************************************************************************
20
 */
21
22
/**
23
 * Chargement des handlers utilisés par le module
24
 */
25
class references_handler
26
{
27
    public         $h_references_articles   = null;
28
    public         $h_references_categories = null;
29
    private static $instance                = false;
30
31
    /**
32
     * Singleton
33
     */
34
    private function __construct()
35
    {
36
        $handlersNames = array('references_articles', 'references_categories');
37
        foreach ($handlersNames as $handlerName) {
38
            $internalName        = 'h_' . $handlerName;
39
            $this->$internalName = xoops_getModuleHandler($handlerName, REFERENCES_DIRNAME);
40
        }
41
    }
42
43
    /**
44
     * Retourne l'instance unique de la clanss
45
     *
46
     * @return object
47
     */
48
    public static function getInstance()
49
    {
50
        static $instance;
51
        if (null === $instance) {
52
            $instance = new static();
53
        }
54
55
        return $instance;
56
    }
57
}
58