blob: cf237c235ff9b50d7f8d704ef262481093f66efc (
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
|
<?php
namespace SMW\Query\ProfileAnnotators;
use SMW\DIProperty;
use SMW\Query\ProfileAnnotator;
use SMWDINumber as DINumber;
/**
* @license GNU GPL v2+
* @since 1.9
*
* @author mwjames
*/
class DurationProfileAnnotator extends ProfileAnnotatorDecorator {
/**
* @var integer
*/
private $duration;
/**
* @since 1.9
*
* @param ProfileAnnotator $profileAnnotator
* @param integer $duration
*/
public function __construct( ProfileAnnotator $profileAnnotator, $duration ) {
parent::__construct( $profileAnnotator );
$this->duration = $duration;
}
/**
* ProfileAnnotatorDecorator::addPropertyValues
*/
protected function addPropertyValues() {
if ( $this->duration > 0 ) {
$this->addGreaterThanZeroQueryDuration( $this->duration );
}
}
private function addGreaterThanZeroQueryDuration( $duration ) {
$this->getSemanticData()->addPropertyObjectValue(
new DIProperty( '_ASKDU' ),
new DINumber( $duration )
);
}
}
|