@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @throws InvalidArgumentException |
34 | 34 | */ |
35 | - public function __construct( EntityIdFormatter $formatter, $escapeCallback ) { |
|
36 | - if ( !is_callable( $escapeCallback ) ) { |
|
37 | - throw new InvalidArgumentException( '$escapeCallback must be callable' ); |
|
35 | + public function __construct(EntityIdFormatter $formatter, $escapeCallback) { |
|
36 | + if (!is_callable($escapeCallback)) { |
|
37 | + throw new InvalidArgumentException('$escapeCallback must be callable'); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | $this->formatter = $formatter; |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return string Typically wikitext or HTML, depending on the $escapeCallback provided. |
50 | 50 | */ |
51 | - public function formatEntityId( EntityId $value ) { |
|
52 | - $text = $this->formatter->formatEntityId( $value ); |
|
53 | - $escaped = ( $this->escapeCallback )( $text ); |
|
51 | + public function formatEntityId(EntityId $value) { |
|
52 | + $text = $this->formatter->formatEntityId($value); |
|
53 | + $escaped = ($this->escapeCallback)($text); |
|
54 | 54 | return $escaped; |
55 | 55 | } |
56 | 56 |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @throws InvalidArgumentException |
35 | 35 | */ |
36 | - public function __construct( array $composers ) { |
|
37 | - foreach ( $composers as $entityType => $composer ) { |
|
38 | - if ( !is_string( $entityType ) || $entityType === '' || !is_callable( $composer ) ) { |
|
39 | - throw new InvalidArgumentException( '$composers must map non-empty strings to callables' ); |
|
36 | + public function __construct(array $composers) { |
|
37 | + foreach ($composers as $entityType => $composer) { |
|
38 | + if (!is_string($entityType) || $entityType === '' || !is_callable($composer)) { |
|
39 | + throw new InvalidArgumentException('$composers must map non-empty strings to callables'); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
@@ -53,15 +53,15 @@ discard block |
||
53 | 53 | * object. |
54 | 54 | * @return EntityId |
55 | 55 | */ |
56 | - public function composeEntityId( $entityType, $uniquePart ) { |
|
57 | - if ( !isset( $this->composers[$entityType] ) ) { |
|
58 | - throw new InvalidArgumentException( 'Unknown entity type ' . $entityType ); |
|
56 | + public function composeEntityId($entityType, $uniquePart) { |
|
57 | + if (!isset($this->composers[$entityType])) { |
|
58 | + throw new InvalidArgumentException('Unknown entity type ' . $entityType); |
|
59 | 59 | } |
60 | 60 | |
61 | - $id = $this->composers[$entityType]( $uniquePart ); |
|
61 | + $id = $this->composers[$entityType]($uniquePart); |
|
62 | 62 | |
63 | - if ( !( $id instanceof EntityId ) ) { |
|
64 | - throw new UnexpectedValueException( 'Composer for ' . $entityType . ' is invalid' ); |
|
63 | + if (!($id instanceof EntityId)) { |
|
64 | + throw new UnexpectedValueException('Composer for ' . $entityType . ' is invalid'); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | return $id; |
@@ -20,7 +20,7 @@ |
||
20 | 20 | * |
21 | 21 | * @return string Plain text |
22 | 22 | */ |
23 | - public function formatEntityId( EntityId $entityId ) { |
|
23 | + public function formatEntityId(EntityId $entityId) { |
|
24 | 24 | return $entityId->getSerialization(); |
25 | 25 | } |
26 | 26 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param string $prefix The prefix to be stripped. Stripping is case sensitive. |
32 | 32 | * @param EntityIdParser $idParser |
33 | 33 | */ |
34 | - public function __construct( $prefix, EntityIdParser $idParser ) { |
|
34 | + public function __construct($prefix, EntityIdParser $idParser) { |
|
35 | 35 | $this->prefix = $prefix; |
36 | 36 | $this->idParser = $idParser; |
37 | 37 | } |
@@ -47,16 +47,16 @@ discard block |
||
47 | 47 | * or the remaining suffix is not a valid entity ID string. |
48 | 48 | * @return EntityId |
49 | 49 | */ |
50 | - public function parse( $idSerialization ) { |
|
51 | - $prefixLength = strlen( $this->prefix ); |
|
50 | + public function parse($idSerialization) { |
|
51 | + $prefixLength = strlen($this->prefix); |
|
52 | 52 | |
53 | - if ( strncmp( $idSerialization, $this->prefix, $prefixLength ) !== 0 ) { |
|
54 | - throw new EntityIdParsingException( 'Missing expected prefix "' . $this->prefix |
|
55 | - . '" in "' . $idSerialization . '"' ); |
|
53 | + if (strncmp($idSerialization, $this->prefix, $prefixLength) !== 0) { |
|
54 | + throw new EntityIdParsingException('Missing expected prefix "' . $this->prefix |
|
55 | + . '" in "' . $idSerialization . '"'); |
|
56 | 56 | } |
57 | 57 | |
58 | - $idSerialization = substr( $idSerialization, $prefixLength ); |
|
59 | - return $this->idParser->parse( $idSerialization ); |
|
58 | + $idSerialization = substr($idSerialization, $prefixLength); |
|
59 | + return $this->idParser->parse($idSerialization); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | } |
@@ -44,6 +44,6 @@ |
||
44 | 44 | * @return EntityId[] A list of EntityIds matching the given parameters. Will |
45 | 45 | * be empty if there are no more entities to list from the given offset. |
46 | 46 | */ |
47 | - public function fetchIds( $limit ); |
|
47 | + public function fetchIds($limit); |
|
48 | 48 | |
49 | 49 | } |
@@ -19,6 +19,6 @@ |
||
19 | 19 | * @return string Either plain text, wikitext or HTML. |
20 | 20 | * @throws \InvalidArgumentException when value falls out of supported patterns by the formatter |
21 | 21 | */ |
22 | - public function formatEntityId( EntityId $value ); |
|
22 | + public function formatEntityId(EntityId $value); |
|
23 | 23 | |
24 | 24 | } |
@@ -20,6 +20,6 @@ |
||
20 | 20 | /** |
21 | 21 | * @param mixed $position Round trips with method getPosition |
22 | 22 | */ |
23 | - public function setPosition( $position ); |
|
23 | + public function setPosition($position); |
|
24 | 24 | |
25 | 25 | } |
@@ -20,12 +20,12 @@ |
||
20 | 20 | * |
21 | 21 | * @param EntityId[] $entityIds |
22 | 22 | */ |
23 | - public function prefetch( array $entityIds ); |
|
23 | + public function prefetch(array $entityIds); |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Purges prefetched data about a given entity. |
27 | 27 | */ |
28 | - public function purge( EntityId $entityId ); |
|
28 | + public function purge(EntityId $entityId); |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Purges all prefetched data. |
@@ -21,13 +21,13 @@ |
||
21 | 21 | * |
22 | 22 | * @param EntityId[] $entityIds |
23 | 23 | */ |
24 | - public function prefetch( array $entityIds ) { |
|
24 | + public function prefetch(array $entityIds) { |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Purges prefetched data about a given entity. |
29 | 29 | */ |
30 | - public function purge( EntityId $entityId ) { |
|
30 | + public function purge(EntityId $entityId) { |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |