Completed
Push — master ( 1bb428...fe8713 )
by Tobias
8s
created

Base::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 2
b 0
f 1
1
<?php
2
3
/**
4
FreeIPA library for PHP
5
Copyright (C) 2015  Tobias Sette <[email protected]>
6
7
This program is free software: you can redistribute it and/or modify
8
it under the terms of the GNU Lesser General Public License as published by
9
the Free Software Foundation, either version 3 of the License, or
10
(at your option) any later version.
11
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
GNU Lesser General Public License for more details.
16
17
You should have received a copy of the GNU Lesser General Public License
18
along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
*/
20
21
// Dependencies:
0 ignored issues
show
Unused Code Comprehensibility introduced by
63% 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
//require_once('Connection.php');
23
24
/**
25
 * Classes for access to FreeIPA API
26
 * @since GIT: 0.1.0
27
 */
28
namespace FreeIPA\APIAccess;
29
30
/**
31
 * This class defines common things for other classes that reuses an
32
 * received connection
33
 * 
34
 * @author Tobias Sette <[email protected]>
35
 * @copyright Copyright (c) 2015 Tobias Sette <[email protected]>
36
 * @license LGPLv3
37
 * @package php-freeipa
38
 * @since GIT: 0.1.0
39
 * @version GIT: 0.2.0
40
 */
41
class Base
42
{
43
    /**
44
     *
45
     * @var Connection stores a connection with the freeIPA server 
46
     * @since GIT: 0.1.0
47
     */
48
    protected $_connection = false;
49
    
50
    
51
    /**
52
     * @param \FreeIPA\APIAccess\Connection $connection
53
     * @since GIT: 0.1.0
54
     * @version GIT: 0.1.0
55
     */
56
    public function __construct(Connection $connection)
57
    {
58
        $this->setConnection($connection);
59
    }
60
    
61
    /**
62
     * @param \FreeIPA\APIAccess\Connection $connection
63
     * @since GIT: 0.1.0
64
     * @version GIT: 0.1.0
65
     */
66
    public function setConnection(Connection $connection)
67
    {
68
        $this->_connection = $connection;
69
    }
70
    
71
    /**
72
     * @return \FreeIPA\APIAccess\Connection
73
     * @since GIT: 0.1.0
74
     * @version GIT: 0.2.0
75
     */
76
    public function getConnection()
77
    {
78
        if (false === $this->_connection) {
79
            throw new \Exception('No connection');
80
        } else {
81
            return($this->_connection);
82
        }
83
    }
84
}
85