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

SecurityScheme::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 2
Metric Value
c 2
b 0
f 2
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 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