Completed
Push — master ( 10a146...62fa38 )
by Thomas
8s
created

ExtensionPart::parseExtensions()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3.0987

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
ccs 7
cts 9
cp 0.7778
rs 9.4285
cc 3
eloc 6
nc 3
nop 1
crap 3.0987
1
<?php
2
namespace gossi\swagger\parts;
3
4
use phootwork\collection\Map;
5
use phootwork\lang\Text;
6
7
trait ExtensionPart {
8
	
9
	private $extensions;
10
	
11 12
	private function parseExtensions(Map $data) {
12 12
		$this->extensions = new Map();
13
14 12
		foreach ($data as $k => $v) {
15 6
			$key = new Text($k);
16 6
			if ($key->startsWith('x-')) {
17
				$this->extensions->set($key->substring(2), $v);
18
			}
19 12
		}
20 12
	}
21
	
22
	/**
23
	 * Returns extensions
24
	 * 
25
	 * @return Map
26
	 */
27 7
	public function getExtensions() {
28 7
		return $this->extensions;
29
	}
30
}