@@ -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 | ]; |
@@ -14,6 +14,6 @@ |
||
| 14 | 14 | * |
| 15 | 15 | * @return Constraint[] |
| 16 | 16 | */ |
| 17 | - public function queryConstraintsForProperty( PropertyId $propertyId ); |
|
| 17 | + public function queryConstraintsForProperty(PropertyId $propertyId); |
|
| 18 | 18 | |
| 19 | 19 | } |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | * @codeCoverageIgnore |
| 73 | 73 | */ |
| 74 | 74 | private function __construct() { |
| 75 | - throw new LogicException( 'This class should never be instantiated.' ); |
|
| 75 | + throw new LogicException('This class should never be instantiated.'); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | } |
@@ -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 | |
@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | * @param int $maxAge The maximum age of the cached value (in seconds). |
| 30 | 30 | * @return self Indication that a value is possibly outdated by up to this many seconds. |
| 31 | 31 | */ |
| 32 | - public static function ofMaximumAgeInSeconds( $maxAge ) { |
|
| 33 | - Assert::parameterType( 'integer', $maxAge, '$maxAge' ); |
|
| 34 | - Assert::parameter( $maxAge > 0, '$maxAge', '$maxage > 0' ); |
|
| 32 | + public static function ofMaximumAgeInSeconds($maxAge) { |
|
| 33 | + Assert::parameterType('integer', $maxAge, '$maxAge'); |
|
| 34 | + Assert::parameter($maxAge > 0, '$maxAge', '$maxage > 0'); |
|
| 35 | 35 | $ret = new self; |
| 36 | 36 | $ret->maxAge = $maxAge; |
| 37 | 37 | return $ret; |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | * @param array|null $array As returned by toArray. |
| 43 | 43 | * @return self |
| 44 | 44 | */ |
| 45 | - public static function ofArray( array $array = null ) { |
|
| 45 | + public static function ofArray(array $array = null) { |
|
| 46 | 46 | $ret = new self; |
| 47 | - if ( $array !== null ) { |
|
| 47 | + if ($array !== null) { |
|
| 48 | 48 | $ret->maxAge = $array['maximumAgeInSeconds']; |
| 49 | 49 | } |
| 50 | 50 | return $ret; |
@@ -54,11 +54,11 @@ discard block |
||
| 54 | 54 | * @param self[] $metadatas |
| 55 | 55 | * @return self |
| 56 | 56 | */ |
| 57 | - public static function merge( array $metadatas ) { |
|
| 58 | - Assert::parameterElementType( self::class, $metadatas, '$metadatas' ); |
|
| 57 | + public static function merge(array $metadatas) { |
|
| 58 | + Assert::parameterElementType(self::class, $metadatas, '$metadatas'); |
|
| 59 | 59 | $ret = new self; |
| 60 | - foreach ( $metadatas as $metadata ) { |
|
| 61 | - $ret->maxAge = max( $ret->maxAge, $metadata->maxAge ); |
|
| 60 | + foreach ($metadatas as $metadata) { |
|
| 61 | + $ret->maxAge = max($ret->maxAge, $metadata->maxAge); |
|
| 62 | 62 | } |
| 63 | 63 | return $ret; |
| 64 | 64 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * For a fresh value, returns 0. |
| 77 | 77 | */ |
| 78 | 78 | public function getMaximumAgeInSeconds() { |
| 79 | - if ( is_int( $this->maxAge ) ) { |
|
| 79 | + if (is_int($this->maxAge)) { |
|
| 80 | 80 | return $this->maxAge; |
| 81 | 81 | } else { |
| 82 | 82 | return 0; |
@@ -91,8 +91,7 @@ discard block |
||
| 91 | 91 | return $this->isCached() ? |
| 92 | 92 | [ |
| 93 | 93 | 'maximumAgeInSeconds' => $this->maxAge, |
| 94 | - ] : |
|
| 95 | - null; |
|
| 94 | + ] : null; |
|
| 96 | 95 | } |
| 97 | 96 | |
| 98 | 97 | } |
@@ -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 | } |