Completed
Pull Request — master (#9)
by Jacob
02:56
created

SecurityScheme   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 1 Features 2
Metric Value
wmc 3
c 4
b 1
f 2
lcom 1
cbo 1
dl 0
loc 35
ccs 10
cts 10
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A parse() 0 4 1
A toArray() 0 3 1
1
<?php
2
namespace gossi\swagger;
3
4
use phootwork\lang\Arrayable;
5
6
class SecurityScheme extends AbstractModel implements Arrayable {
7
8
	/** @var string */
9
	private $name;
10
11
	/** @var string */
12
	private $type;
13
14
	/** @var string */
15
	private $description;
16
17
	/**
18
	 * @param string $name
19
	 * @param array $contents
20
	 */
21 1
	public function __construct($name, $contents = []) {
22 1
		$this->name = $name;
23 1
		$this->parse($contents);
24 1
	}
25
26
	/**
27
	 * @param array $contents
28
	 */
29 1
	private function parse($contents = []) {
30 1
		$this->type = $contents->get('type');
0 ignored issues
show
Bug introduced by
The method get cannot be called on $contents (of type array).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
31 1
		$this->description = $contents->get('description');
0 ignored issues
show
Bug introduced by
The method get cannot be called on $contents (of type array).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
32 1
	}
33
34
	/**
35
	 * @return array
36
	 */
37 1
	public function toArray() {
38 1
		return $this->export('type', 'description');
39
	}
40
}
41