Skip to content

Commit

Permalink
fixs
Browse files Browse the repository at this point in the history
  • Loading branch information
docjyJ committed Oct 5, 2024
1 parent bc00121 commit c714012
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
29 changes: 29 additions & 0 deletions lib/Models/ServerStatus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace OCA\Stalwart\Models;

use JsonSerializable;

enum ServerStatus: string implements JsonSerializable {
case Success = 'success';
case NoAdmin = 'unprivileged';
case Unauthorized = 'unauthorized';
case BadServer = 'bad_server';
case BadNetwork = 'bad_network';
case Invalid = 'invalid';

public function jsonSerialize(): string {
return $this->value;
}
public static function fromRow(mixed $value): ?ServerStatus {
return is_string($value) ? match ($value) {
'success' => ServerStatus::Success,
'unprivileged' => ServerStatus::NoAdmin,
'unauthorized' => ServerStatus::Unauthorized,
'bad_server' => ServerStatus::BadServer,
'bad_network' => ServerStatus::BadNetwork,
'invalid' => ServerStatus::Invalid,
default => null
} : null;
}
}
12 changes: 0 additions & 12 deletions lib/Services/ServerStatus.php

This file was deleted.

0 comments on commit c714012

Please sign in to comment.