Skip to content

Commit

Permalink
Use function instead of fn and restore PHP 7.0 - 7.3 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
thekid committed Mar 29, 2024
1 parent e1dc254 commit c8e8ad7
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/main/php/web/auth/cas/CasFlow.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,23 @@ public function authenticate($request, $response, $session) {
try {
$stream= new XmlStreaming($validate->in());
$result= $stream->next(new ValueOf([], [
'cas:authenticationFailure' => fn(&$self) => $self['failure']= yield new ValueOf([], [
'@code' => fn(&$self) => $self['code']= yield,
'.' => fn(&$self) => $self['message']= trim(yield),
]),
'cas:authenticationSuccess' => fn(&$self) => $self['user']= yield new ValueOf([], [
'cas:user' => fn(&$self) => $self['username']= yield,
'cas:attributes' => fn(&$self) => $self+= yield new ValueOf([], [
'*' => fn(&$self, $name) => $self[str_replace('cas:', '', $name)]= yield,
'cas:authenticationFailure' => function(&$self) {
$self['failure']= yield new ValueOf([], [
'@code' => function(&$self) { $self['code']= yield; },
'.' => function(&$self) { $self['message']= trim(yield); },
]);
},
'cas:authenticationSuccess' => function(&$self) {
$self['user']= yield new ValueOf([], [
'cas:user' => function(&$self) { $self['username']= yield; },
'cas:attributes' => function(&$self) {
$self+= yield new ValueOf([], ['*' => function(&$self, $name) {
$self[str_replace('cas:', '', $name)]= yield;
}]);
}
])
]),
'*' => fn(&$self, $name) => $self[$name]= yield,
},
'*' => function(&$self, $name) { $self[$name]= yield; }
]));
} catch (Throwable $e) {
throw new Error(500, 'UNEXPECTED: Streaming error', $e);
Expand Down

0 comments on commit c8e8ad7

Please sign in to comment.