Added view proxies

This commit is contained in:
Marcin Kurczewski 2014-08-31 09:09:17 +02:00
parent 18d9c21435
commit 2335037a9c
3 changed files with 34 additions and 2 deletions

View file

@ -28,8 +28,8 @@ final class AuthController extends AbstractController
throw new \Szurubooru\MissingArgumentException(); throw new \Szurubooru\MissingArgumentException();
return [ return [
'token' => $this->authService->getLoginToken(), 'token' => new \Szurubooru\ViewProxies\Token($this->authService->getLoginToken()),
'user' => $this->authService->getLoggedInUser() 'user' => new \Szurubooru\ViewProxies\User($this->authService->getLoggedInUser()),
]; ];
} }
} }

17
src/ViewProxies/Token.php Normal file
View file

@ -0,0 +1,17 @@
<?php
namespace Szurubooru\ViewProxies;
class Token
{
public $name;
public $purpose;
public function __construct($token)
{
if (!$token)
return;
$this->name = $token->name;
$this->purpose = $token->purpose;
}
}

15
src/ViewProxies/User.php Normal file
View file

@ -0,0 +1,15 @@
<?php
namespace Szurubooru\ViewProxies;
class User
{
public $name;
public function __construct($user)
{
if (!$user)
return;
$this->name = $user->name;
}
}