Passed
Push — master ( 3a7c7a...fe0bb9 )
by Sam
03:04
created

Property   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
dl 0
loc 29
ccs 9
cts 12
cp 0.75
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getReferences() 0 9 3
A __construct() 0 4 1
1
<?php
2
3
namespace Samwilson\SimpleWikidata;
4
5
use Psr\Cache\CacheItemPoolInterface;
6
7
abstract class Property {
8
9
		/** @var string[] */
10
	protected $claim;
11
12
		/** @var string */
13
	protected $lang;
14
15
		/** @var CacheItemPoolInterface */
16
	protected $cache;
17
18 2
		public function __construct( $claim, $lang, $cache ) {
19 2
		$this->claim = $claim;
20 2
		$this->lang = $lang;
21 2
		$this->cache = $cache;
22 2
	 }
23
24
	/**
25
	 * @return Reference[]
26
	 */
27 1
	public function getReferences() {
28 1
		$references = [];
29 1
		if ( !isset( $this->claim['references'] ) ) {
30 1
			return $references;
31
		}
32
		foreach ( $this->claim['references'] as $ref ) {
0 ignored issues
show
Bug introduced by
The expression $this->claim['references'] of type string is not traversable.
Loading history...
33
			$references[] = new Reference( $ref, $this->lang, $this->cache );
34
		}
35
		return $references;
36
	}
37
}
38