@@ -10,5 +10,5 @@ |
||
10 | 10 | |
11 | 11 | /** English (English) */ |
12 | 12 | $specialPageAliases['en'] = [ |
13 | - 'ConstraintReport' => [ 'ConstraintReport', 'Constraint Report' ], |
|
13 | + 'ConstraintReport' => ['ConstraintReport', 'Constraint Report'], |
|
14 | 14 | ]; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @throws ConstraintParameterException if the constraint parameters are invalid |
23 | 23 | * @throws SparqlHelperException if the checker uses SPARQL and the query times out or some other error occurs |
24 | 24 | */ |
25 | - public function checkConstraint( Context $context, Constraint $constraint ); |
|
25 | + public function checkConstraint(Context $context, Constraint $constraint); |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Check if the constraint parameters of $constraint are valid. |
@@ -33,6 +33,6 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @return ConstraintParameterException[] |
35 | 35 | */ |
36 | - public function checkConstraintParameters( Constraint $constraint ); |
|
36 | + public function checkConstraintParameters(Constraint $constraint); |
|
37 | 37 | |
38 | 38 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | private $metadata; |
22 | 22 | |
23 | - public function __construct( array $array, Metadata $metadata ) { |
|
23 | + public function __construct(array $array, Metadata $metadata) { |
|
24 | 24 | $this->array = $array; |
25 | 25 | $this->metadata = $metadata; |
26 | 26 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | * @param bool $bool |
25 | 25 | * @param Metadata $metadata |
26 | 26 | */ |
27 | - public function __construct( $bool, Metadata $metadata ) { |
|
27 | + public function __construct($bool, Metadata $metadata) { |
|
28 | 28 | $this->bool = $bool; |
29 | 29 | $this->metadata = $metadata; |
30 | 30 | } |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | return $ret; |
33 | 33 | } |
34 | 34 | |
35 | - public static function ofCachingMetadata( CachingMetadata $cachingMetadata ) { |
|
35 | + public static function ofCachingMetadata(CachingMetadata $cachingMetadata) { |
|
36 | 36 | $ret = new self; |
37 | 37 | $ret->cachingMetadata = $cachingMetadata; |
38 | 38 | $ret->dependencyMetadata = DependencyMetadata::blank(); |
39 | 39 | return $ret; |
40 | 40 | } |
41 | 41 | |
42 | - public static function ofDependencyMetadata( DependencyMetadata $dependencyMetadata ) { |
|
42 | + public static function ofDependencyMetadata(DependencyMetadata $dependencyMetadata) { |
|
43 | 43 | $ret = new self; |
44 | 44 | $ret->cachingMetadata = CachingMetadata::fresh(); |
45 | 45 | $ret->dependencyMetadata = $dependencyMetadata; |
@@ -50,17 +50,17 @@ discard block |
||
50 | 50 | * @param self[] $metadatas |
51 | 51 | * @return self |
52 | 52 | */ |
53 | - public static function merge( array $metadatas ) { |
|
54 | - Assert::parameterElementType( self::class, $metadatas, '$metadatas' ); |
|
53 | + public static function merge(array $metadatas) { |
|
54 | + Assert::parameterElementType(self::class, $metadatas, '$metadatas'); |
|
55 | 55 | $cachingMetadatas = []; |
56 | 56 | $dependencyMetadatas = []; |
57 | - foreach ( $metadatas as $metadata ) { |
|
57 | + foreach ($metadatas as $metadata) { |
|
58 | 58 | $cachingMetadatas[] = $metadata->cachingMetadata; |
59 | 59 | $dependencyMetadatas[] = $metadata->dependencyMetadata; |
60 | 60 | } |
61 | 61 | $ret = new self; |
62 | - $ret->cachingMetadata = CachingMetadata::merge( $cachingMetadatas ); |
|
63 | - $ret->dependencyMetadata = DependencyMetadata::merge( $dependencyMetadatas ); |
|
62 | + $ret->cachingMetadata = CachingMetadata::merge($cachingMetadatas); |
|
63 | + $ret->dependencyMetadata = DependencyMetadata::merge($dependencyMetadatas); |
|
64 | 64 | return $ret; |
65 | 65 | } |
66 | 66 |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | StatementList $statementList, |
31 | 31 | PropertyId $propertyId |
32 | 32 | ) { |
33 | - $statementListByPropertyId = $statementList->getByPropertyId( $propertyId ); |
|
34 | - if ( $statementListByPropertyId->isEmpty() ) { |
|
33 | + $statementListByPropertyId = $statementList->getByPropertyId($propertyId); |
|
34 | + if ($statementListByPropertyId->isEmpty()) { |
|
35 | 35 | return null; |
36 | 36 | } else { |
37 | 37 | return $statementListByPropertyId->toArray()[0]; |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | PropertyId $propertyId, |
53 | 53 | EntityId $value |
54 | 54 | ) { |
55 | - $statementListByPropertyId = $statementList->getByPropertyId( $propertyId ); |
|
55 | + $statementListByPropertyId = $statementList->getByPropertyId($propertyId); |
|
56 | 56 | /** @var Statement $statement */ |
57 | - foreach ( $statementListByPropertyId as $statement ) { |
|
57 | + foreach ($statementListByPropertyId as $statement) { |
|
58 | 58 | $snak = $statement->getMainSnak(); |
59 | - if ( $snak instanceof PropertyValueSnak ) { |
|
59 | + if ($snak instanceof PropertyValueSnak) { |
|
60 | 60 | $dataValue = $snak->getDataValue(); |
61 | - if ( $dataValue instanceof EntityIdValue && |
|
62 | - $dataValue->getEntityId()->equals( $value ) |
|
61 | + if ($dataValue instanceof EntityIdValue && |
|
62 | + $dataValue->getEntityId()->equals($value) |
|
63 | 63 | ) { |
64 | 64 | return $statement; |
65 | 65 | } |
@@ -82,12 +82,12 @@ discard block |
||
82 | 82 | PropertyId $propertyId, |
83 | 83 | array $values |
84 | 84 | ) { |
85 | - $statementListByPropertyId = $statementList->getByPropertyId( $propertyId ); |
|
85 | + $statementListByPropertyId = $statementList->getByPropertyId($propertyId); |
|
86 | 86 | /** @var Statement $statement */ |
87 | - foreach ( $statementListByPropertyId as $statement ) { |
|
87 | + foreach ($statementListByPropertyId as $statement) { |
|
88 | 88 | $snak = $statement->getMainSnak(); |
89 | - foreach ( $values as $value ) { |
|
90 | - if ( $value->matchesSnak( $snak ) ) { |
|
89 | + foreach ($values as $value) { |
|
90 | + if ($value->matchesSnak($snak)) { |
|
91 | 91 | return $statement; |
92 | 92 | } |
93 | 93 | } |
@@ -16,27 +16,27 @@ |
||
16 | 16 | */ |
17 | 17 | private $timeValueCalculator; |
18 | 18 | |
19 | - public function __construct( TimeValueCalculator $timeValueCalculator = null ) { |
|
19 | + public function __construct(TimeValueCalculator $timeValueCalculator = null) { |
|
20 | 20 | $this->timeValueCalculator = $timeValueCalculator ?: new TimeValueCalculator(); |
21 | 21 | } |
22 | 22 | |
23 | - public function getComparison( TimeValue $lhs, TimeValue $rhs ) { |
|
24 | - $lhsTimestamp = $this->timeValueCalculator->getTimestamp( $lhs ); |
|
25 | - $rhsTimestamp = $this->timeValueCalculator->getTimestamp( $rhs ); |
|
23 | + public function getComparison(TimeValue $lhs, TimeValue $rhs) { |
|
24 | + $lhsTimestamp = $this->timeValueCalculator->getTimestamp($lhs); |
|
25 | + $rhsTimestamp = $this->timeValueCalculator->getTimestamp($rhs); |
|
26 | 26 | |
27 | - if ( $lhsTimestamp === $rhsTimestamp ) { |
|
27 | + if ($lhsTimestamp === $rhsTimestamp) { |
|
28 | 28 | return 0; |
29 | 29 | } |
30 | 30 | |
31 | 31 | return $lhsTimestamp < $rhsTimestamp ? -1 : 1; |
32 | 32 | } |
33 | 33 | |
34 | - public function getMinimum( TimeValue $timeValue1, TimeValue $timeValue2 ) { |
|
35 | - return $this->getComparison( $timeValue1, $timeValue2 ) <= 0 ? $timeValue1 : $timeValue2; |
|
34 | + public function getMinimum(TimeValue $timeValue1, TimeValue $timeValue2) { |
|
35 | + return $this->getComparison($timeValue1, $timeValue2) <= 0 ? $timeValue1 : $timeValue2; |
|
36 | 36 | } |
37 | 37 | |
38 | - public function isFutureTime( TimeValue $timeValue ) { |
|
39 | - return $this->getComparison( $timeValue, new NowValue() ) >= 0; |
|
38 | + public function isFutureTime(TimeValue $timeValue) { |
|
39 | + return $this->getComparison($timeValue, new NowValue()) >= 0; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @return string |
29 | 29 | */ |
30 | 30 | public function getTime() { |
31 | - return gmdate( '+Y-m-d\TH:i:s\Z' ); |
|
31 | + return gmdate('+Y-m-d\TH:i:s\Z'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | public function getTimezone() { |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | public function getArrayValue() { |
43 | - throw new LogicException( 'NowValue should never be serialized' ); |
|
43 | + throw new LogicException('NowValue should never be serialized'); |
|
44 | 44 | } |
45 | 45 | |
46 | - public function equals( $value ) { |
|
47 | - return get_class( $value ) === self::class; |
|
46 | + public function equals($value) { |
|
47 | + return get_class($value) === self::class; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | /** |
17 | 17 | * @param bool $serializeConstraintParameters Whether to serialize constraint parameters or not. |
18 | 18 | */ |
19 | - public function __construct( $serializeConstraintParameters = true ) { |
|
19 | + public function __construct($serializeConstraintParameters = true) { |
|
20 | 20 | $this->serializeConstraintParameters = $serializeConstraintParameters; |
21 | 21 | } |
22 | 22 | |
@@ -24,13 +24,13 @@ discard block |
||
24 | 24 | * @param Constraint $constraint |
25 | 25 | * @return array |
26 | 26 | */ |
27 | - public function serialize( Constraint $constraint ) { |
|
27 | + public function serialize(Constraint $constraint) { |
|
28 | 28 | $serialization = [ |
29 | 29 | 'id' => $constraint->getConstraintId(), |
30 | 30 | 'pid' => $constraint->getPropertyId()->getSerialization(), |
31 | 31 | 'qid' => $constraint->getConstraintTypeItemId(), |
32 | 32 | ]; |
33 | - if ( $this->serializeConstraintParameters ) { |
|
33 | + if ($this->serializeConstraintParameters) { |
|
34 | 34 | $serialization['params'] = $constraint->getConstraintParameters(); |
35 | 35 | } |
36 | 36 | return $serialization; |