blob: f200f19bbad4c8797facfb0a08e2dfef22f5e6a0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
<?php
namespace SMW\Tests\Utils\Fixtures\Properties;
use SMW\DataValueFactory;
use SMW\DIProperty;
use SMW\SemanticData;
/**
* @license GNU GPL v2+
* @since 2.1
*
* @author mwjames
*/
class AreaProperty extends FixtureProperty {
/**
* @var array
*/
private $conversionValues = [
'1 km²',
'0.38610 sq mi',
'1000 m²',
'247.1054 acre',
'988.4215 rood'
];
/**
* @since 2.1
*/
public function __construct() {
$this->property = new DIProperty( 'Area' );
$this->property->setPropertyTypeId( '_qty' );
}
/**
* @since 2.1
*
* @return SemanticData
*/
public function getDependencies() {
$semanticData = parent::getDependencies();
$dataValueFactory = DataValueFactory::getInstance();
foreach( $this->conversionValues as $conversionValue ) {
$semanticData->addDataValue(
$dataValueFactory->newDataValueByProperty(
new DIProperty( '_CONV' ),
$conversionValue
)
);
}
return $semanticData;
}
}
|