Skip to content

Commit f45ef86

Browse files
committed
Refactor code to no longer require xp-lang/xp-enums
This package is deprecated, see xp-framework/compiler#106
1 parent f283fc7 commit f45ef86

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"xp-forge/credentials": "^2.0",
1818
"xp-forge/google-authenticator": "^5.0",
1919
"xp-lang/php-compact-methods": "^1.0",
20-
"xp-lang/xp-enums": "^1.0",
2120
"xp-lang/xp-records": "^1.0",
2221
"php" : ">=7.0.0"
2322
},

src/main/php/de/thekid/cas/impl/ServiceResponse.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
use xml\{Tree, Node};
44

55
/** CAS service response - in XML and JSON */
6-
abstract enum ServiceResponse {
7-
XML {
6+
abstract class ServiceResponse {
7+
public static $XML= new class() extends ServiceResponse {
88
public function success($user) {
99
$n= new Node('cas:authenticationSuccess')->withChild(new Node('cas:user', $user['username']));
1010
if (isset($user['attributes'])) {
@@ -29,8 +29,8 @@ public function transmit($response, $result) {
2929

3030
$response->send($tree->getSource(INDENT_DEFAULT), 'text/xml');
3131
}
32-
},
33-
JSON {
32+
};
33+
public static $JSON= new class() extends ServiceResponse {
3434
public function success($user) {
3535
$success= ['user' => $user['username']];
3636
if (isset($user['attributes'])) {

0 commit comments

Comments
 (0)