Skip to content

Commit b0d307d

Browse files
committed
Message: Remove deprecated getter methods
1 parent eba25b3 commit b0d307d

File tree

4 files changed

+4
-137
lines changed

4 files changed

+4
-137
lines changed

ApnsPHP/Message.php

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,6 @@ public function selfForRecipient(int $recipient = 0)
205205
return $copy;
206206
}
207207

208-
/**
209-
* Get the number of recipients.
210-
*
211-
* @deprecated Use getRecipientsCount() instead.
212-
*
213-
* @return int Recipient's number.
214-
*/
215-
public function getRecipientsNumber(): int
216-
{
217-
return $this->getRecipientsCount();
218-
}
219-
220208
/**
221209
* Get the number of recipients.
222210
*
@@ -419,44 +407,6 @@ public function setCustomProperty(string $name, $value): void
419407
$this->customProperties[$name] = $value;
420408
}
421409

422-
/**
423-
* Get the first custom property name.
424-
*
425-
* @deprecated Use getCustomPropertyNames() instead.
426-
*
427-
* @return string The first custom property name.
428-
*/
429-
public function getCustomPropertyName(): string
430-
{
431-
if (empty($this->customProperties)) {
432-
throw new Exception(
433-
"No custom property exists!"
434-
);
435-
}
436-
437-
$keys = array_keys($this->customProperties);
438-
return $keys[0];
439-
}
440-
441-
/**
442-
* Get the first custom property value.
443-
*
444-
* @deprecated Use getCustomProperty() instead.
445-
*
446-
* @return mixed The first custom property value.
447-
*/
448-
public function getCustomPropertyValue()
449-
{
450-
if (empty($this->customProperties)) {
451-
throw new Exception(
452-
"No custom property exists!"
453-
);
454-
}
455-
456-
$aKeys = array_keys($this->customProperties);
457-
return $this->customProperties[$aKeys[0]];
458-
}
459-
460410
/**
461411
* Get all custom properties names.
462412
*

ApnsPHP/Push.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ protected function getJsonWebToken(): string
470470
public function add(Message $message): void
471471
{
472472
$messagePayload = $message->getPayload();
473-
$recipients = $message->getRecipientsNumber();
473+
$recipients = $message->getRecipientsCount();
474474

475475
$messageQueueLen = count($this->messageQueue);
476476
for ($i = 0; $i < $recipients; $i++) {

ApnsPHP/Tests/MessageGetTest.php

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -229,70 +229,6 @@ public function testGetCustomIdentifier(): void
229229
$this->assertSame('3491ac4b-0681-4c92-8308-d8d8441f4e64', $value);
230230
}
231231

232-
/**
233-
* Test that getCustomPropertyName() gets the first property name.
234-
*
235-
* @covers \ApnsPHP\Message::getCustomPropertyName
236-
*/
237-
public function testGetCustomPropertyNameReturnsFirstPropertyName(): void
238-
{
239-
$properties = [
240-
'my-title' => 'My Title',
241-
'my-message' => 'My Message',
242-
];
243-
244-
$this->set_reflection_property_value('customProperties', $properties);
245-
246-
$value = $this->class->getCustomPropertyName();
247-
248-
$this->assertSame('my-title', $value);
249-
}
250-
251-
/**
252-
* Test that getCustomPropertyName() throws an exception if no custom property is set.
253-
*
254-
* @covers \ApnsPHP\Message::getCustomPropertyName
255-
*/
256-
public function testGetCustomPropertyNameThrowsExceptionWhenNoneSet(): void
257-
{
258-
$this->expectException('ApnsPHP\Message\Exception');
259-
$this->expectExceptionMessage('No custom property exists!');
260-
261-
$this->class->getCustomPropertyName();
262-
}
263-
264-
/**
265-
* Test that getCustomPropertyValue() gets the first property value.
266-
*
267-
* @covers \ApnsPHP\Message::getCustomPropertyValue
268-
*/
269-
public function testGetCustomPropertyValueReturnsFirstPropertyValue(): void
270-
{
271-
$properties = [
272-
'my-title' => 'My Title',
273-
'my-message' => 'My Message',
274-
];
275-
276-
$this->set_reflection_property_value('customProperties', $properties);
277-
278-
$value = $this->class->getCustomPropertyValue();
279-
280-
$this->assertSame('My Title', $value);
281-
}
282-
283-
/**
284-
* Test that getCustomPropertyValue() throws an exception if no custom property is set.
285-
*
286-
* @covers \ApnsPHP\Message::getCustomPropertyValue
287-
*/
288-
public function testGetCustomPropertyValueThrowsExceptionWhenNoneSet(): void
289-
{
290-
$this->expectException('ApnsPHP\Message\Exception');
291-
$this->expectExceptionMessage('No custom property exists!');
292-
293-
$this->class->getCustomPropertyValue();
294-
}
295-
296232
/**
297233
* Test that getCustomPropertyValue() successfully returns an existing property.
298234
*
@@ -363,25 +299,6 @@ public function testGetCustomPropertyNamesWithoutPropertiesSet(): void
363299
$this->assertArrayEmpty($value);
364300
}
365301

366-
/**
367-
* Test that getRecipientsNumber() returns the count of set device tokens.
368-
*
369-
* @covers \ApnsPHP\Message::getRecipientsNumber
370-
*/
371-
public function testGetRecipientsNumber(): void
372-
{
373-
$tokens = [
374-
'1e82db91c7ceddd72bf33d74ae052ac9c84a065b35148ac401388843106a7485L',
375-
'1e82db91c7ceddd72bf33d74ae052ac9c84a065b35148ac401388843106a7485B'
376-
];
377-
378-
$this->set_reflection_property_value('deviceTokens', $tokens);
379-
380-
$value = $this->class->getRecipientsNumber();
381-
382-
$this->assertSame(2, $value);
383-
}
384-
385302
/**
386303
* Test that getRecipientsCount() returns the count of set device tokens.
387304
*

ApnsPHP/Tests/PushAddTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function testAddOneMessage(): void
2929
->will($this->returnValue('payload'));
3030

3131
$this->message->expects($this->once())
32-
->method('getRecipientsNumber')
32+
->method('getRecipientsCount')
3333
->will($this->returnValue(1));
3434

3535
$this->message->expects($this->once())
@@ -63,7 +63,7 @@ public function testAddMultipleMessages(): void
6363
->will($this->returnValue('payload'));
6464

6565
$this->message->expects($this->once())
66-
->method('getRecipientsNumber')
66+
->method('getRecipientsCount')
6767
->will($this->returnValue(4));
6868

6969
$this->message->expects($this->exactly(4))
@@ -90,7 +90,7 @@ public function testAddDoesNothing(): void
9090
->will($this->returnValue('payload'));
9191

9292
$this->message->expects($this->once())
93-
->method('getRecipientsNumber')
93+
->method('getRecipientsCount')
9494
->will($this->returnValue(0));
9595

9696
$this->class->add($this->message);

0 commit comments

Comments
 (0)