@@ -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 | } |
@@ -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; |
@@ -92,43 +92,43 @@ |
||
| 92 | 92 | return $this->referenceHash; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - protected function &getMainArray( array &$container ) { |
|
| 96 | - $statementArray = &$this->getStatementArray( $container ); |
|
| 95 | + protected function &getMainArray(array &$container) { |
|
| 96 | + $statementArray = &$this->getStatementArray($container); |
|
| 97 | 97 | |
| 98 | - if ( !array_key_exists( 'references', $statementArray ) ) { |
|
| 98 | + if (!array_key_exists('references', $statementArray)) { |
|
| 99 | 99 | $statementArray['references'] = []; |
| 100 | 100 | } |
| 101 | 101 | $referencesArray = &$statementArray['references']; |
| 102 | 102 | |
| 103 | 103 | $referenceHash = $this->getReferenceHash(); |
| 104 | - foreach ( $referencesArray as &$potentialReferenceArray ) { |
|
| 105 | - if ( $potentialReferenceArray['hash'] === $referenceHash ) { |
|
| 104 | + foreach ($referencesArray as &$potentialReferenceArray) { |
|
| 105 | + if ($potentialReferenceArray['hash'] === $referenceHash) { |
|
| 106 | 106 | $referenceArray = &$potentialReferenceArray; |
| 107 | 107 | break; |
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | - if ( !isset( $referenceArray ) ) { |
|
| 111 | - $referenceArray = [ 'hash' => $referenceHash, 'snaks' => [] ]; |
|
| 110 | + if (!isset($referenceArray)) { |
|
| 111 | + $referenceArray = ['hash' => $referenceHash, 'snaks' => []]; |
|
| 112 | 112 | $referencesArray[] = &$referenceArray; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | $snaksArray = &$referenceArray['snaks']; |
| 116 | 116 | |
| 117 | 117 | $snakPropertyId = $this->getSnakPropertyId(); |
| 118 | - if ( !array_key_exists( $snakPropertyId, $snaksArray ) ) { |
|
| 118 | + if (!array_key_exists($snakPropertyId, $snaksArray)) { |
|
| 119 | 119 | $snaksArray[$snakPropertyId] = []; |
| 120 | 120 | } |
| 121 | 121 | $propertyArray = &$snaksArray[$snakPropertyId]; |
| 122 | 122 | |
| 123 | 123 | $snakHash = $this->getSnakHash(); |
| 124 | - foreach ( $propertyArray as &$potentialSnakArray ) { |
|
| 125 | - if ( $potentialSnakArray['hash'] === $snakHash ) { |
|
| 124 | + foreach ($propertyArray as &$potentialSnakArray) { |
|
| 125 | + if ($potentialSnakArray['hash'] === $snakHash) { |
|
| 126 | 126 | $snakArray = &$potentialSnakArray; |
| 127 | 127 | break; |
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | - if ( !isset( $snakArray ) ) { |
|
| 131 | - $snakArray = [ 'hash' => $snakHash ]; |
|
| 130 | + if (!isset($snakArray)) { |
|
| 131 | + $snakArray = ['hash' => $snakHash]; |
|
| 132 | 132 | $propertyArray[] = &$snakArray; |
| 133 | 133 | } |
| 134 | 134 | |