AdldapService   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 35
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getInstance() 0 6 1
1
<?php
2
3
namespace Riper\Security\ActiveDirectoryBundle\Service;
4
5
use adLDAP\adLDAP;
6
7
class AdldapService
8
{
9
    /**
10
     * @var adLDAP The instance of adLdap used for each call of the service
11
     */
12
    private $adLdap;
13
14
    /**
15
     * @var array The Active Directory parameters (see riper.security.active_directory.settings)
16
     */
17
    private $parameters;
18
19
    /**
20
     * Constructor for the service.
21
     *
22
     * @param array $parameters Active Directory parameters
23
     */
24
    public function __construct(array $parameters)
25
    {
26
        $parameters['account_suffix'] = '@' . $parameters['account_suffix'];
27
        $this->parameters = $parameters;
28
    }
29
30
    /**
31
     * Returns an adLDAP instance.
32
     *
33
     * @return adLDAP The instance of the adLdap (lib)
34
     */
35
    public function getInstance()
36
    {
37
        $this->adLdap = new adLDAP($this->parameters);
38
39
        return $this->adLdap;
40
    }
41
}
42