@@ -14,11 +14,11 @@ |
||
14 | 14 | * Updates the stored terms for the specified item. |
15 | 15 | * @throws TermStoreException |
16 | 16 | */ |
17 | - public function storeTerms( ItemId $itemId, Fingerprint $terms ); |
|
17 | + public function storeTerms(ItemId $itemId, Fingerprint $terms); |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * @throws TermStoreException |
21 | 21 | */ |
22 | - public function deleteTerms( ItemId $itemId ); |
|
22 | + public function deleteTerms(ItemId $itemId); |
|
23 | 23 | |
24 | 24 | } |
@@ -21,6 +21,6 @@ |
||
21 | 21 | * |
22 | 22 | * @return EntityId[] a map of strings from $labels to the corresponding entity ID. |
23 | 23 | */ |
24 | - public function getPropertyIdsForLabels( array $labels, $recache = '' ); |
|
24 | + public function getPropertyIdsForLabels(array $labels, $recache = ''); |
|
25 | 25 | |
26 | 26 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * i.e. any of TermTypes::TYPE_LABEL, TermTypes::TYPE_DESCRIPTION, TermTypes::TYPE_ALIAS |
27 | 27 | * @param string[] $languageCodes The desired languages. |
28 | 28 | */ |
29 | - public function prefetchTerms( array $entityIds, array $termTypes, array $languageCodes ); |
|
29 | + public function prefetchTerms(array $entityIds, array $termTypes, array $languageCodes); |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Returns a term that was previously loaded by prefetchTerms. |
@@ -38,6 +38,6 @@ discard block |
||
38 | 38 | * @return string|false|null The term, or false of that term is known to not exist, |
39 | 39 | * or null if the term was not yet requested via prefetchTerms(). |
40 | 40 | */ |
41 | - public function getPrefetchedTerm( EntityId $entityId, $termType, $languageCode ); |
|
41 | + public function getPrefetchedTerm(EntityId $entityId, $termType, $languageCode); |
|
42 | 42 | |
43 | 43 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | * @param string|null $message |
25 | 25 | * @param Exception|null $previous |
26 | 26 | */ |
27 | - public function __construct( EntityId $entityId, $message = null, ?Exception $previous = null ) { |
|
27 | + public function __construct(EntityId $entityId, $message = null, ?Exception $previous = null) { |
|
28 | 28 | $this->entityId = $entityId; |
29 | 29 | |
30 | 30 | parent::__construct( |
@@ -24,7 +24,7 @@ |
||
24 | 24 | * @param string|null $message |
25 | 25 | * @param Exception|null $previous |
26 | 26 | */ |
27 | - public function __construct( EntityId $entityId, $message = null, ?Exception $previous = null ) { |
|
27 | + public function __construct(EntityId $entityId, $message = null, ?Exception $previous = null) { |
|
28 | 28 | $this->entityId = $entityId; |
29 | 29 | |
30 | 30 | parent::__construct( |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | private $entityLookup; |
23 | 23 | private array $propertyIdsInProcess = []; |
24 | 24 | |
25 | - public function __construct( EntityLookup $entityLookup ) { |
|
25 | + public function __construct(EntityLookup $entityLookup) { |
|
26 | 26 | $this->entityLookup = $entityLookup; |
27 | 27 | } |
28 | 28 | |
@@ -34,16 +34,16 @@ discard block |
||
34 | 34 | * @return string |
35 | 35 | * @throws PropertyDataTypeLookupException |
36 | 36 | */ |
37 | - public function getDataTypeIdForProperty( PropertyId $propertyId ) { |
|
38 | - if ( array_key_exists( $propertyId->getSerialization(), $this->propertyIdsInProcess ) ) { |
|
37 | + public function getDataTypeIdForProperty(PropertyId $propertyId) { |
|
38 | + if (array_key_exists($propertyId->getSerialization(), $this->propertyIdsInProcess)) { |
|
39 | 39 | // avoid self-referencing loop for newly created properties (T374230) |
40 | - throw new PropertyDataTypeLookupException( $propertyId, 'loop detected' ); |
|
40 | + throw new PropertyDataTypeLookupException($propertyId, 'loop detected'); |
|
41 | 41 | } |
42 | - $this->propertyIdsInProcess[ $propertyId->getSerialization() ] = true; |
|
42 | + $this->propertyIdsInProcess[$propertyId->getSerialization()] = true; |
|
43 | 43 | try { |
44 | - return $this->getProperty( $propertyId )->getDataTypeId(); |
|
44 | + return $this->getProperty($propertyId)->getDataTypeId(); |
|
45 | 45 | } finally { |
46 | - unset( $this->propertyIdsInProcess[ $propertyId->getSerialization() ] ); |
|
46 | + unset($this->propertyIdsInProcess[$propertyId->getSerialization()]); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | * @return Property |
54 | 54 | * @throws PropertyDataTypeLookupException |
55 | 55 | */ |
56 | - private function getProperty( PropertyId $propertyId ) { |
|
57 | - $property = $this->entityLookup->getEntity( $propertyId ); |
|
56 | + private function getProperty(PropertyId $propertyId) { |
|
57 | + $property = $this->entityLookup->getEntity($propertyId); |
|
58 | 58 | |
59 | - if ( !( $property instanceof Property ) ) { |
|
60 | - throw new PropertyDataTypeLookupException( $propertyId ); |
|
59 | + if (!($property instanceof Property)) { |
|
60 | + throw new PropertyDataTypeLookupException($propertyId); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | return $property; |
@@ -28,14 +28,14 @@ |
||
28 | 28 | */ |
29 | 29 | private WeakMap $restrictedEntityLookupMap; |
30 | 30 | |
31 | - public function __construct( EntityLookup $entityLookup, int $entityAccessLimit ) { |
|
31 | + public function __construct(EntityLookup $entityLookup, int $entityAccessLimit) { |
|
32 | 32 | $this->entityLookup = $entityLookup; |
33 | 33 | $this->entityAccessLimit = $entityAccessLimit; |
34 | 34 | $this->restrictedEntityLookupMap = new WeakMap(); |
35 | 35 | } |
36 | 36 | |
37 | - public function getRestrictedEntityLookup( Parser $parser ): RestrictedEntityLookup { |
|
38 | - $this->restrictedEntityLookupMap[$parser] ??= new RestrictedEntityLookup( $this->entityLookup, $this->entityAccessLimit ); |
|
37 | + public function getRestrictedEntityLookup(Parser $parser): RestrictedEntityLookup { |
|
38 | + $this->restrictedEntityLookupMap[$parser] ??= new RestrictedEntityLookup($this->entityLookup, $this->entityAccessLimit); |
|
39 | 39 | |
40 | 40 | return $this->restrictedEntityLookupMap[$parser]; |
41 | 41 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | private $propertyDataTypeLookup; |
26 | 26 | |
27 | - public function __construct( PropertyDataTypeLookup $propertyDataTypeLookup ) { |
|
27 | + public function __construct(PropertyDataTypeLookup $propertyDataTypeLookup) { |
|
28 | 28 | $this->propertyDataTypeLookup = $propertyDataTypeLookup; |
29 | 29 | } |
30 | 30 | |
@@ -36,15 +36,15 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @return DataValue[] |
38 | 38 | */ |
39 | - public function findFromSnaks( array $snaks, $dataType ) { |
|
39 | + public function findFromSnaks(array $snaks, $dataType) { |
|
40 | 40 | $found = []; |
41 | 41 | |
42 | - foreach ( $snaks as $snak ) { |
|
43 | - if ( $snak instanceof PropertyValueSnak && |
|
44 | - $this->isMatchingDataType( $snak->getPropertyId(), $dataType ) |
|
42 | + foreach ($snaks as $snak) { |
|
43 | + if ($snak instanceof PropertyValueSnak && |
|
44 | + $this->isMatchingDataType($snak->getPropertyId(), $dataType) |
|
45 | 45 | ) { |
46 | 46 | $dataValue = $snak->getDataValue(); |
47 | - if ( method_exists( $dataValue, 'getHash' ) ) { |
|
47 | + if (method_exists($dataValue, 'getHash')) { |
|
48 | 48 | // We can only tag values as found that are |
49 | 49 | // hashable. DataValueObject should, but `getDataValue` |
50 | 50 | // only returns the `DataValue` interface, which doesn't |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return bool |
66 | 66 | */ |
67 | - private function isMatchingDataType( PropertyId $propertyId, $dataType ) { |
|
67 | + private function isMatchingDataType(PropertyId $propertyId, $dataType) { |
|
68 | 68 | try { |
69 | - return $this->propertyDataTypeLookup->getDataTypeIdForProperty( $propertyId ) === $dataType; |
|
70 | - } catch ( PropertyDataTypeLookupException ) { |
|
69 | + return $this->propertyDataTypeLookup->getDataTypeIdForProperty($propertyId) === $dataType; |
|
70 | + } catch (PropertyDataTypeLookupException) { |
|
71 | 71 | return false; |
72 | 72 | } |
73 | 73 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | */ |
20 | 20 | private $lookup; |
21 | 21 | |
22 | - public function __construct( EntityLookup $lookup ) { |
|
22 | + public function __construct(EntityLookup $lookup) { |
|
23 | 23 | $this->lookup = $lookup; |
24 | 24 | } |
25 | 25 | |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | * @param EntityId $entityId |
31 | 31 | * @return EntityDocument|null |
32 | 32 | */ |
33 | - public function getEntity( EntityId $entityId ) { |
|
33 | + public function getEntity(EntityId $entityId) { |
|
34 | 34 | try { |
35 | - return $this->lookup->getEntity( $entityId ); |
|
36 | - } catch ( EntityLookupException ) { |
|
35 | + return $this->lookup->getEntity($entityId); |
|
36 | + } catch (EntityLookupException) { |
|
37 | 37 | return null; |
38 | 38 | } |
39 | 39 | } |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | * @param EntityId $entityId |
47 | 47 | * @return bool |
48 | 48 | */ |
49 | - public function hasEntity( EntityId $entityId ) { |
|
50 | - return $this->lookup->hasEntity( $entityId ); |
|
49 | + public function hasEntity(EntityId $entityId) { |
|
50 | + return $this->lookup->hasEntity($entityId); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | } |