Completed
Push — master ( aa79f5...006947 )
by Raphaël
03:14
created

RegistrationCertain   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 40
Duplicated Lines 45 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 3
Bugs 1 Features 0
Metric Value
wmc 6
c 3
b 1
f 0
lcom 0
cbo 1
dl 18
loc 40
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getRessourceName() 0 3 1
A getMandatoryFields() 0 4 1
A getRegistrations() 9 9 2
A getRegistrationsByEventCode() 9 9 2

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
namespace Wabel\CertainAPI\Ressources;
3
4
use Wabel\CertainAPI\Interfaces\CertainRessourceInterface;
5
use Wabel\CertainAPI\CertainRessourceAbstract;
6
7
/**
8
 * RegistrationCertain about the Registration entity
9
 *
10
 * @author rbergina
11
 */
12
class RegistrationCertain extends CertainRessourceAbstract implements CertainRessourceInterface
13
{
14
    public function getRessourceName(){
15
        return 'Registration';
16
    }
17
    public function getMandatoryFields()
18
    {
19
        return array('profile');
20
    }
21
22
    /**
23
     * Return with all the result from certain.
24
     * @return RegistrationCertain[]
25
     */
26 View Code Duplication
    public function getRegistrations()
0 ignored issues
show
Duplication introduced by
This method 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...
27
    {
28
        $request=  $this->get();
29
        if($request->isSuccessFul()){
30
            $registrationCertainResults = $request->getResults();
31
            return $registrationCertainResults->registrations;
32
        }
33
        return null;
34
    }
35
    
36
    /**
37
     * Return with all the result from certain.
38
     * @return RegistrationCertain[]
39
     */
40 View Code Duplication
    public function getRegistrationsByEventCode($eventCode)
0 ignored issues
show
Duplication introduced by
This method 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...
41
    {
42
        $request=  $this->get($eventCode);
43
        if($request->isSuccessFul()){
44
            $registrationCertainResults = $request->getResults();
45
            return $registrationCertainResults->registrations;
46
        }
47
        return null;
48
    }
49
    
50
    
51
}