From 2335037a9ca9d60a5b889f424fcf32d3c4e6b707 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Sun, 31 Aug 2014 09:09:17 +0200 Subject: [PATCH] Added view proxies --- src/Controllers/AuthController.php | 4 ++-- src/ViewProxies/Token.php | 17 +++++++++++++++++ src/ViewProxies/User.php | 15 +++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 src/ViewProxies/Token.php create mode 100644 src/ViewProxies/User.php diff --git a/src/Controllers/AuthController.php b/src/Controllers/AuthController.php index ec76f6b8..21b01146 100644 --- a/src/Controllers/AuthController.php +++ b/src/Controllers/AuthController.php @@ -28,8 +28,8 @@ final class AuthController extends AbstractController throw new \Szurubooru\MissingArgumentException(); return [ - 'token' => $this->authService->getLoginToken(), - 'user' => $this->authService->getLoggedInUser() + 'token' => new \Szurubooru\ViewProxies\Token($this->authService->getLoginToken()), + 'user' => new \Szurubooru\ViewProxies\User($this->authService->getLoggedInUser()), ]; } } diff --git a/src/ViewProxies/Token.php b/src/ViewProxies/Token.php new file mode 100644 index 00000000..b31218ad --- /dev/null +++ b/src/ViewProxies/Token.php @@ -0,0 +1,17 @@ +name = $token->name; + $this->purpose = $token->purpose; + } +} diff --git a/src/ViewProxies/User.php b/src/ViewProxies/User.php new file mode 100644 index 00000000..6a27b21f --- /dev/null +++ b/src/ViewProxies/User.php @@ -0,0 +1,15 @@ +name = $user->name; + } +}