Completed
Branch master (b963e0)
by Michael
03:39
created

Publisher::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/*
3
 You may not change or alter any portion of this comment or credits
4
 of supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit authors.
6
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
 */
11
/**
12
 *  Publisher class
13
 *
14
 * @copyright       The XUUPS Project http://sourceforge.net/projects/xuups/
15
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
16
 * @package         Class
17
 * @subpackage      Utils
18
 * @since           1.0
19
 * @author          trabis <[email protected]>
20
 */
21
// defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
22
23
class Publisher extends \Xmf\Module\Helper
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
24
{
25
    public $debugArray = [];
26
27
    /**
28
     * @internal param $debug
29
     */
30
    protected function __construct()
31
    {
32
        //        $this->debug   = $debug;
0 ignored issues
show
Unused Code Comprehensibility introduced by
45% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
33
        $this->dirname = basename(dirname(__DIR__));
34
    }
35
36
    /**
37
     * @param bool $debug
38
     *
39
     * @return Publisher
40
     */
41
    public static function getInstance($debug = false)
42
    {
43
        static $instance;
44
        if (null === $instance) {
45
            $instance = new static($debug);
46
        }
47
48
        return $instance;
49
    }
50
51
    /**
52
     * @param null|string $name
53
     * @param null|string $value
54
     *
55
     * @return mixed
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use null|string.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
56
     */
57
    public function setConfig($name = null, $value = null)
58
    {
59
        if (null === $this->configs) {
60
            $this->initConfig();
61
        }
62
        $this->configs[$name] = $value;
63
        $this->addLog("Setting config '{$name}' : " . $this->configs[$name]);
64
65
        return $this->configs[$name];
66
    }
67
68
    /**
69
     * @return string
70
     */
71
    public function getDirname()
72
    {
73
        return $this->dirname;
74
    }
75
}
76