diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2025-09-11 13:19:21 +0200 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2025-09-11 13:19:21 +0200 |
commit | b1b101fd98c8b4354a4e0c73e867d817466de30e (patch) | |
tree | 763e6d3dab13a2af8c324f7f879c5874dced76f2 /src/Support | |
parent | db014ebf9f8f84a1a0d0972298e70bf29e57c37e (diff) |
sync, rooms, events, etc
Diffstat (limited to 'src/Support')
-rw-r--r-- | src/Support/Logger.php | 50 | ||||
-rw-r--r-- | src/Support/Parser.php | 26 |
2 files changed, 68 insertions, 8 deletions
diff --git a/src/Support/Logger.php b/src/Support/Logger.php index fb86166..c806157 100644 --- a/src/Support/Logger.php +++ b/src/Support/Logger.php @@ -2,22 +2,64 @@ namespace App\Support; +use Psr\Log\LoggerInterface; use Symfony\Component\HttpFoundation\Request; -class Logger +class Logger implements LoggerInterface { public static function logRequestToFile(Request $request): void { - $basePath = dirname(dirname(__DIR__)) . "/.phpunit.cache/" . str_replace("/", "_", $request->getPathInfo()); + $basePath = dirname(dirname(__DIR__)) . "/.cache/log/" . str_replace("/", "_", $request->getPathInfo()); file_put_contents( $basePath . "-body.json", - $request->getContent() + json_encode(json_decode($request->getContent()), JSON_PRETTY_PRINT) + ); + + file_put_contents( + $basePath . "-query.json", + json_encode($request->query->all(), JSON_PRETTY_PRINT) ); file_put_contents( $basePath . "-header.json", - json_encode($request->headers->all()) + json_encode($request->headers->all(), JSON_PRETTY_PRINT) ); } + + public function emergency($message, array $context = []): void + { + } + + public function alert($message, array $context = []): void + { + } + + public function critical($message, array $context = []): void + { + } + + public function error($message, array $context = []): void + { + } + + public function warning($message, array $context = []): void + { + } + + public function notice($message, array $context = []): void + { + } + + public function info($message, array $context = []): void + { + } + + public function debug($message, array $context = []): void + { + } + + public function log($level, $message, array $context = []): void + { + } } diff --git a/src/Support/Parser.php b/src/Support/Parser.php index d850de1..02ec251 100644 --- a/src/Support/Parser.php +++ b/src/Support/Parser.php @@ -4,10 +4,10 @@ namespace App\Support; class Parser { - /** - * @return array<string, string> - */ - public static function parseUser(string $user): array + /** + * @return array<string, string> + */ + public static function parseUser(string $user): array { $username = $user; $server = ""; @@ -24,4 +24,22 @@ class Parser "server" => $server, ]; } + + /** + * @return array<string, string> + */ + public static function parseRoomAlias(string $alias): array + { + $name = ""; + $server = ""; + + $parts = explode(":", $alias); + $name = substr($parts[0], 1); + $server = $parts[1]; + + return [ + "name" => $name, + "server" => $server, + ]; + } } |