Completed
Push — master ( 0ef921...49b538 )
by Martijn
03:08
created

ParameterReference   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 30
loc 30
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 6 6 1
A toArray() 6 6 1
A __toString() 4 4 1
A getName() 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
namespace SwaggerGen\Swagger;
4
5
/**
6
 * Describes a reference to a Parameter.
7
 *
8
 * @package    SwaggerGen
9
 * @author     Martijn van der Lee <[email protected]>
10
 * @copyright  2014-2016 Martijn van der Lee
11
 * @license    https://opensource.org/licenses/MIT MIT
12
 */
13 View Code Duplication
class ParameterReference extends AbstractObject implements IParameter
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...
14
{
15
16
	private $reference = '';
17
18
	public function __construct(AbstractObject $parent, $reference)
19
	{
20
		parent::__construct($parent);
21
22
		$this->reference = $reference;
23
	}
24
25
	public function toArray()
26
	{
27
		return self::arrayFilterNull(array(
28
					'$ref' => '#/parameters/' . $this->reference,
29
		));
30
	}
31
32
	public function __toString()
33
	{
34
		return __CLASS__ . " {$this->reference}";
35
	}
36
37
	public function getName()
38
	{
39
		return $this->reference;
40
	}
41
42
}
43