Completed
Branch FET-8365-add-indexes (3fce8d)
by
unknown
512:51 queued 496:29
created

EE_Extra_Join   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1
Metric Value
wmc 3
lcom 0
cbo 1
dl 24
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A new_instance() 4 4 2
A new_instance_from_db() 3 3 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 if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
/**
3
 * Contains definition for EE_Extra_Join model object
4
 * @package 		Event Espresso
5
 * @subpackage 	models
6
 * @since 			$VID$
7
 */
8
9
/**
10
 * EE_Extra_Join
11
 * This is the model object for EEM_Event_Message_Template
12
 *
13
 * @package 		Event Espresso
14
 * @subpackage 	models
15
 * @author 			Darren Ethier
16
 * @since 			4.3.0
17
 */
18 View Code Duplication
class EE_Extra_Join extends EE_Base_Class {
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...
19
20
	/**
21
	 * @param array $props_n_values
22
	 * @param null  $timezone
23
	 * @return EE_Extra_Join|mixed
24
	 */
25
	public static function new_instance( $props_n_values = array(), $timezone = NULL ) {
26
		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone );
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (_check_for_object() instead of new_instance()). Are you sure this is correct? If so, you might want to change this to $this->_check_for_object().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
27
		return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone );
28
	}
29
30
31
32
	/**
33
	 * @param array $props_n_values
34
	 * @param null  $timezone
35
	 * @return EE_Extra_Join
36
	 */
37
	public static function new_instance_from_db ( $props_n_values = array(), $timezone = NULL ) {
38
		return new self( $props_n_values, TRUE, $timezone );
39
	}
40
41
}
42
//end class EE_Extra_Join
43