Germany::newFingerprint()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 8
cts 8
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Wikibase\DataFixtures\Items;
4
5
use Wikibase\DataFixtures\Properties\InstanceOfProperty;
6
use Wikibase\DataModel\Entity\EntityIdValue;
7
use Wikibase\DataModel\Entity\Item;
8
use Wikibase\DataModel\Entity\ItemId;
9
use Wikibase\DataModel\Snak\PropertyValueSnak;
10
use Wikibase\DataModel\Statement\StatementList;
11
use Wikibase\DataModel\Term\Fingerprint;
12
13
/**
14
 * @licence GNU GPL v2+
15
 * @author Jeroen De Dauw < [email protected] >
16
 */
17
class Germany {
18
19 1
	public function newFingerprint() {
20 1
		$fingerprint = new Fingerprint();
21
22 1
		$fingerprint->setLabel( 'en', 'Germany' );
23 1
		$fingerprint->setLabel( 'de', 'Deutschland' );
24 1
		$fingerprint->setLabel( 'nl', 'Duitsland' );
25
26 1
		$fingerprint->setDescription( 'en', 'capital city and state of Germany' );
27 1
		$fingerprint->setDescription( 'de', 'Staat in Mitteleuropa' );
28
29 1
		return $fingerprint;
30
	}
31
32 1
	public function newItem() {
33 1
		$item = new Item( $this->newItemId() );
34
35 1
		$item->setFingerprint( $this->newFingerprint() );
36 1
		$item->setStatements( $this->newStatements() );
37
38 1
		return $item;
39
	}
40
41 1
	public function newStatements() {
42 1
		$statements = new StatementList();
43
44 1
		$statements->addNewStatement(
45 1
			new PropertyValueSnak(
46 1
				( new InstanceOfProperty() )->newPropertyId(),
47 1
				new EntityIdValue( ( new State() )->newItemId() )
48 1
			),
49 1
			null,
50 1
			null,
51
			'kittens'
52 1
		);
53
54 1
		return $statements;
55
	}
56
57 1
	public function newItemId() {
58 1
		return new ItemId( 'Q183' );
59
	}
60
61
}
62