ItemRow   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 41
ccs 0
cts 16
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setItemJson() 0 8 2
A getItemJson() 0 3 1
A getItemInfo() 0 10 1
1
<?php
2
3
namespace Queryr\EntityStore\Data;
4
5
use InvalidArgumentException;
6
7
/**
8
 * Value object representing a row in the items table.
9
 * Package public.
10
 *
11
 * @licence GNU GPL v2+
12
 * @author Jeroen De Dauw < [email protected] >
13
 */
14
class ItemRow {
15
	use ItemRowInfo;
16
17
	private $itemJson;
18
19
	/**
20
	 * @param string $itemJson
21
	 * @return $this
22
	 * @throws InvalidArgumentException
23
	 */
24
	public function setItemJson( $itemJson ) {
25
		if ( !is_string( $itemJson ) ) {
26
			throw new InvalidArgumentException( '$itemJson should be a string' );
27
		}
28
29
		$this->itemJson = $itemJson;
30
		return $this;
31
	}
32
33
	/**
34
	 * @return string
35
	 */
36
	public function getItemJson() {
37
		return $this->itemJson;
38
	}
39
40
	/**
41
	 * @return ItemInfo
42
	 */
43
	public function getItemInfo() {
44
		return ( new ItemInfo() )
45
			->setPageTitle( $this->getPageTitle() )
46
			->setNumericItemId( $this->getNumericItemId() )
47
			->setRevisionId( $this->getRevisionId() )
48
			->setItemType( $this->getItemType() )
49
			->setRevisionTime( $this->getRevisionTime() )
50
			->setEnglishLabel( $this->getEnglishLabel() )
51
			->setEnglishWikipediaTitle( $this->getEnglishWikipediaTitle() );
52
	}
53
54
}
55