Completed
Push — master ( f619f7...59f6c6 )
by Luca
01:16
created

LDAPModel   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 32
loc 32
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A syncWithLDAP() 4 4 1
A testLDAPConfiguration() 4 4 1
A migrateIdLDAP() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * This Driver is based entirely on official documentation of the Mattermost Web
4
 * Services API and you can extend it by following the directives of the documentation.
5
 *
6
 * God bless this mess.
7
 *
8
 * @author Luca Agnello <[email protected]>
9
 * @link https://api.mattermost.com/
10
 */
11
12
namespace Gnello\Mattermost\Models;
13
14
use Psr\Http\Message\ResponseInterface;
15
16
/**
17
 * Class LDAPModel
18
 *
19
 * @package Gnello\Mattermost\Models
20
 */
21 View Code Duplication
class LDAPModel extends AbstractModel
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
22
{
23
    /**
24
     * @var string
25
     */
26
    private static $endpoint = '/ldap';
27
28
    /**
29
     * @return ResponseInterface
30
     */
31
    public function syncWithLDAP()
32
    {
33
        return $this->client->post(self::$endpoint . '/sync');
34
    }
35
36
    /**
37
     * @return ResponseInterface
38
     */
39
    public function testLDAPConfiguration()
40
    {
41
        return $this->client->post(self::$endpoint . '/test');
42
    }
43
44
    /**
45
     * @param array $requestOptions
46
     * @return ResponseInterface
47
     */
48
    public function migrateIdLDAP(array $requestOptions)
49
    {
50
        return $this->client->post(self::$endpoint . '/migrateid', $requestOptions);
51
    }
52
}
53