Skip to content

Commit 15dd08b

Browse files
manickiWMDE bot
authored andcommitted
Removed SerializableEntityId::splitSerialization
Bug: T291823 Depends-On: Ibea6e9236a80b1f132f27dd646ad7a0fa1fe7bf6 Change-Id: Ie3fdbde264ad9b27037915399482c21b7c9c6cce
1 parent 12ed7b1 commit 15dd08b

2 files changed

Lines changed: 0 additions & 68 deletions

File tree

src/Entity/SerializableEntityId.php

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -62,53 +62,6 @@ public function getSerialization() {
6262
return $this->serialization;
6363
}
6464

65-
/**
66-
* Returns an array with 3 elements: the foreign repository name as the first element, the local ID as the last
67-
* element and everything that is in between as the second element.
68-
*
69-
* SerializableEntityId::joinSerialization can be used to restore the original serialization from the parts returned.
70-
*
71-
* @param string $serialization
72-
*
73-
* @throws InvalidArgumentException
74-
* @return string[] Array containing the serialization split into 3 parts.
75-
*/
76-
public static function splitSerialization( $serialization ) {
77-
self::assertValidSerialization( $serialization );
78-
79-
return self::extractSerializationParts( self::normalizeIdSerialization( $serialization ) );
80-
}
81-
82-
/**
83-
* Splits the given ID serialization into an array with the following three elements:
84-
* - the repository name as the first element (empty string for local repository)
85-
* - any parts of the ID serialization but the repository name and the local ID (if any, empty string
86-
* if nothing else present)
87-
* - the local ID
88-
* Note: this method does not perform any validation of the given input. Calling code should take
89-
* care of this!
90-
*
91-
* @param string $serialization
92-
*
93-
* @return string[]
94-
*/
95-
private static function extractSerializationParts( $serialization ) {
96-
$parts = explode( ':', $serialization );
97-
$localPart = array_pop( $parts );
98-
$repoName = array_shift( $parts );
99-
$prefixRemainder = implode( ':', $parts );
100-
101-
if ( $repoName !== null ) {
102-
throw new InvalidArgumentException( 'repo name no longer supported (T291823)' );
103-
}
104-
105-
return [
106-
is_string( $repoName ) ? $repoName : '',
107-
$prefixRemainder,
108-
$localPart,
109-
];
110-
}
111-
11265
/**
11366
* Returns '' for local IDs and the foreign repository name for foreign IDs. For chained IDs (e.g. foo:bar:Q42) it
11467
* will return only the first part.

tests/unit/Entity/EntityIdTest.php

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -108,27 +108,6 @@ public function testGetRepositoryName( EntityId $id, $repoName ) {
108108
$this->assertSame( $repoName, $id->getRepositoryName() );
109109
}
110110

111-
public static function serializationSplitProvider() {
112-
return [
113-
[ 'Q42', [ '', '', 'Q42' ] ],
114-
];
115-
}
116-
117-
/**
118-
* @dataProvider serializationSplitProvider
119-
*/
120-
public function testSplitSerialization( $serialization, $split ) {
121-
$this->assertSame( $split, SerializableEntityId::splitSerialization( $serialization ) );
122-
}
123-
124-
/**
125-
* @dataProvider invalidSerializationProvider
126-
*/
127-
public function testSplitSerializationFails_GivenInvalidSerialization( $serialization ) {
128-
$this->expectException( InvalidArgumentException::class );
129-
SerializableEntityId::splitSerialization( $serialization );
130-
}
131-
132111
public function testGetLocalPart() {
133112
$id = new ItemId( 'Q42' );
134113
$this->assertSame( 'Q42', $id->getLocalPart() );

0 commit comments

Comments
 (0)