AdldapService::getInstance()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
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