Output::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * basic output functions
4
 *
5
 * PHP version 5
6
 *
7
 * @category  PHP
8
 * @package   PSI_Output
9
 * @author    Michael Cramer <[email protected]>
10
 * @copyright 2009 phpSysInfo
11
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License
12
 * @version   SVN: $Id: class.Output.inc.php 569 2012-04-16 06:08:18Z namiltd $
13
 * @link      http://phpsysinfo.sourceforge.net
14
 */
15
 /**
16
 * basic output functions for all output formats
17
 *
18
 * @category  PHP
19
 * @package   PSI_Output
20
 * @author    Michael Cramer <[email protected]>
21
 * @copyright 2009 phpSysInfo
22
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License
23
 * @version   Release: 3.0
24
 * @link      http://phpsysinfo.sourceforge.net
25
 */
26
abstract class Output
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...
27
{
28
    /**
29
     * error object for logging errors
30
     *
31
     * @var Error
32
     */
33
    protected $error;
34
35
    /**
36
     * call the parent constructor and check for needed extensions
37
     */
38
    public function __construct()
39
    {
40
        $this->error = PSI_Error::singleton();
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $this->error is correct as \PSI_Error::singleton() (which targets PSI_Error::singleton()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
41
        $this->_checkConfig();
42
        CommonFunctions::checkForExtensions();
43
    }
44
45
    /**
46
     * read the config file and check for existence
47
     *
48
     * @return void
49
     */
50
    private function _checkConfig()
51
    {
52
        include_once APP_ROOT.'/read_config.php';
53
54
        if ($this->error->errorsExist()) {
55
            $this->error->errorsAsXML();
56
        }
57
    }
58
}
59