@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param TermLookup $termLookup |
30 | 30 | * @param string $languageCode |
31 | 31 | */ |
32 | - public function __construct( TermLookup $termLookup, $languageCode ) { |
|
32 | + public function __construct(TermLookup $termLookup, $languageCode) { |
|
33 | 33 | $this->termLookup = $termLookup; |
34 | 34 | $this->languageCode = $languageCode; |
35 | 35 | } |
@@ -40,18 +40,18 @@ discard block |
||
40 | 40 | * @throws LabelDescriptionLookupException |
41 | 41 | * @return Term|null |
42 | 42 | */ |
43 | - public function getLabel( EntityId $entityId ) { |
|
43 | + public function getLabel(EntityId $entityId) { |
|
44 | 44 | try { |
45 | - $text = $this->termLookup->getLabel( $entityId, $this->languageCode ); |
|
46 | - } catch ( TermLookupException $ex ) { |
|
47 | - throw new LabelDescriptionLookupException( $entityId, 'Failed to lookup label', $ex ); |
|
45 | + $text = $this->termLookup->getLabel($entityId, $this->languageCode); |
|
46 | + } catch (TermLookupException $ex) { |
|
47 | + throw new LabelDescriptionLookupException($entityId, 'Failed to lookup label', $ex); |
|
48 | 48 | } |
49 | 49 | |
50 | - if ( $text === null ) { |
|
50 | + if ($text === null) { |
|
51 | 51 | return null; |
52 | 52 | } |
53 | 53 | |
54 | - return new Term( $this->languageCode, $text ); |
|
54 | + return new Term($this->languageCode, $text); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -60,18 +60,18 @@ discard block |
||
60 | 60 | * @throws LabelDescriptionLookupException |
61 | 61 | * @return Term|null |
62 | 62 | */ |
63 | - public function getDescription( EntityId $entityId ) { |
|
63 | + public function getDescription(EntityId $entityId) { |
|
64 | 64 | try { |
65 | - $text = $this->termLookup->getDescription( $entityId, $this->languageCode ); |
|
66 | - } catch ( TermLookupException $ex ) { |
|
67 | - throw new LabelDescriptionLookupException( $entityId, 'Failed to lookup description', $ex ); |
|
65 | + $text = $this->termLookup->getDescription($entityId, $this->languageCode); |
|
66 | + } catch (TermLookupException $ex) { |
|
67 | + throw new LabelDescriptionLookupException($entityId, 'Failed to lookup description', $ex); |
|
68 | 68 | } |
69 | 69 | |
70 | - if ( $text === null ) { |
|
70 | + if ($text === null) { |
|
71 | 71 | return null; |
72 | 72 | } |
73 | 73 | |
74 | - return new Term( $this->languageCode, $text ); |
|
74 | + return new Term($this->languageCode, $text); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | } |
@@ -21,6 +21,6 @@ |
||
21 | 21 | * @return Property|null |
22 | 22 | * @throws PropertyLookupException |
23 | 23 | */ |
24 | - public function getPropertyForId( PropertyId $propertyId ); |
|
24 | + public function getPropertyForId(PropertyId $propertyId); |
|
25 | 25 | |
26 | 26 | } |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | /** |
36 | 36 | * @param EntityDocument ...$entities |
37 | 37 | */ |
38 | - public function __construct( ...$entities ) { |
|
39 | - foreach ( $entities as $entity ) { |
|
40 | - $this->addEntity( $entity ); |
|
38 | + public function __construct(...$entities) { |
|
39 | + foreach ($entities as $entity) { |
|
40 | + $this->addEntity($entity); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @throws InvalidArgumentException |
48 | 48 | */ |
49 | - public function addEntity( EntityDocument $entity ) { |
|
50 | - if ( $entity->getId() === null ) { |
|
51 | - throw new InvalidArgumentException( 'The entity needs to have an ID' ); |
|
49 | + public function addEntity(EntityDocument $entity) { |
|
50 | + if ($entity->getId() === null) { |
|
51 | + throw new InvalidArgumentException('The entity needs to have an ID'); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | $this->entities[$entity->getId()->getSerialization()] = $entity; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @param EntityLookupException $exception |
64 | 64 | */ |
65 | - public function addException( EntityLookupException $exception ) { |
|
65 | + public function addException(EntityLookupException $exception) { |
|
66 | 66 | $this->exceptions[$exception->getEntityId()->getSerialization()] = $exception; |
67 | 67 | } |
68 | 68 | |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | * @throws EntityLookupException |
75 | 75 | * @return ?EntityDocument |
76 | 76 | */ |
77 | - public function getEntity( EntityId $entityId ) { |
|
78 | - $this->throwExceptionIfNeeded( $entityId ); |
|
77 | + public function getEntity(EntityId $entityId) { |
|
78 | + $this->throwExceptionIfNeeded($entityId); |
|
79 | 79 | |
80 | - if ( array_key_exists( $entityId->getSerialization(), $this->entities ) ) { |
|
80 | + if (array_key_exists($entityId->getSerialization(), $this->entities)) { |
|
81 | 81 | return $this->entities[$entityId->getSerialization()]; |
82 | 82 | } |
83 | 83 | |
@@ -92,26 +92,26 @@ discard block |
||
92 | 92 | * @throws EntityLookupException |
93 | 93 | * @return bool |
94 | 94 | */ |
95 | - public function hasEntity( EntityId $entityId ) { |
|
96 | - $this->throwExceptionIfNeeded( $entityId ); |
|
95 | + public function hasEntity(EntityId $entityId) { |
|
96 | + $this->throwExceptionIfNeeded($entityId); |
|
97 | 97 | |
98 | - return array_key_exists( $entityId->getSerialization(), $this->entities ); |
|
98 | + return array_key_exists($entityId->getSerialization(), $this->entities); |
|
99 | 99 | } |
100 | 100 | |
101 | - private function throwExceptionIfNeeded( EntityId $entityId ) { |
|
102 | - if ( array_key_exists( $entityId->getSerialization(), $this->exceptions ) ) { |
|
101 | + private function throwExceptionIfNeeded(EntityId $entityId) { |
|
102 | + if (array_key_exists($entityId->getSerialization(), $this->exceptions)) { |
|
103 | 103 | throw $this->exceptions[$entityId->getSerialization()]; |
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
107 | 107 | /** @inheritDoc */ |
108 | - public function getItemForId( ItemId $itemId ) { |
|
109 | - return ( new LegacyAdapterItemLookup( $this ) )->getItemForId( $itemId ); |
|
108 | + public function getItemForId(ItemId $itemId) { |
|
109 | + return (new LegacyAdapterItemLookup($this))->getItemForId($itemId); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** @inheritDoc */ |
113 | - public function getPropertyForId( PropertyId $propertyId ) { |
|
114 | - return ( new LegacyAdapterPropertyLookup( $this ) )->getpropertyForId( $propertyId ); |
|
113 | + public function getPropertyForId(PropertyId $propertyId) { |
|
114 | + return (new LegacyAdapterPropertyLookup($this))->getpropertyForId($propertyId); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | private EntityLookup $lookup; |
18 | 18 | |
19 | - public function __construct( EntityLookup $lookup ) { |
|
19 | + public function __construct(EntityLookup $lookup) { |
|
20 | 20 | $this->lookup = $lookup; |
21 | 21 | } |
22 | 22 | |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | * @return Item|null |
27 | 27 | * @throws ItemLookupException |
28 | 28 | */ |
29 | - public function getItemForId( ItemId $itemId ) { |
|
29 | + public function getItemForId(ItemId $itemId) { |
|
30 | 30 | try { |
31 | - return $this->lookup->getEntity( $itemId ); |
|
32 | - } catch ( EntityLookupException $ex ) { |
|
33 | - throw new ItemLookupException( $itemId, $ex->getMessage(), $ex ); |
|
31 | + return $this->lookup->getEntity($itemId); |
|
32 | + } catch (EntityLookupException $ex) { |
|
33 | + throw new ItemLookupException($itemId, $ex->getMessage(), $ex); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | private int $entityAccessCount; |
16 | 16 | private int $entityAccessLimit; |
17 | 17 | |
18 | - public function __construct( EntityId $entityId, int $entityAccessCount, int $entityAccessLimit ) { |
|
18 | + public function __construct(EntityId $entityId, int $entityAccessCount, int $entityAccessLimit) { |
|
19 | 19 | parent::__construct( |
20 | 20 | $entityId, |
21 | 21 | 'Too many entities loaded, must not load more than ' . $entityAccessLimit . ' entities.' |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | private PropertyDataTypeLookup $lookup; |
23 | 23 | |
24 | - public function __construct( PropertyDataTypeLookup $propertyDataTypeLookup ) { |
|
24 | + public function __construct(PropertyDataTypeLookup $propertyDataTypeLookup) { |
|
25 | 25 | $this->lookup = $propertyDataTypeLookup; |
26 | 26 | } |
27 | 27 | |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | * @return string |
32 | 32 | * @throws PropertyDataTypeLookupException |
33 | 33 | */ |
34 | - public function getDataTypeIdForProperty( PropertyId $propertyId ) { |
|
34 | + public function getDataTypeIdForProperty(PropertyId $propertyId) { |
|
35 | 35 | $serializedId = $propertyId->getSerialization(); |
36 | 36 | |
37 | - if ( !array_key_exists( $serializedId, $this->propertyIds ) ) { |
|
38 | - $this->propertyIds[$serializedId] = $this->lookup->getDataTypeIdForProperty( $propertyId ); |
|
37 | + if (!array_key_exists($serializedId, $this->propertyIds)) { |
|
38 | + $this->propertyIds[$serializedId] = $this->lookup->getDataTypeIdForProperty($propertyId); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | return $this->propertyIds[$serializedId]; |
@@ -21,6 +21,6 @@ |
||
21 | 21 | * @return Item|null |
22 | 22 | * @throws ItemLookupException |
23 | 23 | */ |
24 | - public function getItemForId( ItemId $itemId ); |
|
24 | + public function getItemForId(ItemId $itemId); |
|
25 | 25 | |
26 | 26 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @param string|null $message |
20 | 20 | * @param Exception|null $previous |
21 | 21 | */ |
22 | - public function __construct( PropertyId $propertyId, $message = null, ?Exception $previous = null ) { |
|
22 | + public function __construct(PropertyId $propertyId, $message = null, ?Exception $previous = null) { |
|
23 | 23 | parent::__construct( |
24 | 24 | $propertyId, |
25 | 25 | $message ?: 'Property lookup failed for: ' . $propertyId, |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function getPropertyId() { |
34 | 34 | $propertyId = $this->getEntityId(); |
35 | - if ( !( $propertyId instanceof PropertyId ) ) { |
|
36 | - throw new LogicException( 'expected $propertyId to be of type PropertyId' ); |
|
35 | + if (!($propertyId instanceof PropertyId)) { |
|
36 | + throw new LogicException('expected $propertyId to be of type PropertyId'); |
|
37 | 37 | } |
38 | 38 | return $propertyId; |
39 | 39 | } |
@@ -24,6 +24,6 @@ |
||
24 | 24 | * @return EntityId[] |
25 | 25 | * @throws EntityRedirectLookupException |
26 | 26 | */ |
27 | - public function getRedirectIds( EntityId $targetId ); |
|
27 | + public function getRedirectIds(EntityId $targetId); |
|
28 | 28 | |
29 | 29 | } |