forked from immobiliare/ApnsPHP
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Push: Make the APNS environment an enum
- Loading branch information
Showing
11 changed files
with
76 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
/** | ||
* APNS Environment | ||
* | ||
* SPDX-FileCopyrightText: Copyright 2024 Move Agency Group B.V., Zwolle, The Netherlands | ||
* SPDX-License-Identifier: BSD-2-Clause | ||
*/ | ||
|
||
namespace ApnsPHP; | ||
|
||
/** | ||
* APNS Environment. | ||
*/ | ||
enum Environment | ||
{ | ||
/** | ||
* Production environment. | ||
*/ | ||
case Production; | ||
|
||
/** | ||
* Production environment using alternative port. | ||
*/ | ||
case AltProduction; | ||
|
||
/** | ||
* Sandbox environment. | ||
*/ | ||
case Sandbox; | ||
|
||
/** | ||
* Sandbox environment using alternative port. | ||
*/ | ||
case AltSandbox; | ||
|
||
/** | ||
* Get HTTP URL for a given environment | ||
* | ||
* @return string The URL to the matching APNS environment | ||
*/ | ||
public function getUrl(): string | ||
{ | ||
return match ($this) { | ||
Environment::Production => 'https://api.push.apple.com:443', | ||
Environment::AltProduction => 'https://api.push.apple.com:2197', | ||
Environment::Sandbox => 'https://api.sandbox.push.apple.com:443', | ||
Environment::AltSandbox => 'https://api.sandbox.push.apple.com:2197', | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters