2014-08-31 13:34:31 +02:00
|
|
|
<?php
|
|
|
|
namespace Szurubooru\Controllers;
|
|
|
|
|
|
|
|
final class UserController extends AbstractController
|
|
|
|
{
|
|
|
|
private $userService;
|
2014-08-31 14:07:46 +02:00
|
|
|
private $passwordService;
|
|
|
|
private $inputReader;
|
2014-08-31 13:34:31 +02:00
|
|
|
|
2014-08-31 14:07:46 +02:00
|
|
|
public function __construct(
|
|
|
|
\Szurubooru\Services\UserService $userService,
|
|
|
|
\Szurubooru\Services\PasswordService $passwordService,
|
|
|
|
\Szurubooru\Helpers\InputReader $inputReader)
|
2014-08-31 13:34:31 +02:00
|
|
|
{
|
2014-08-31 14:07:46 +02:00
|
|
|
$this->inputReader = $inputReader;
|
2014-08-31 13:34:31 +02:00
|
|
|
$this->userService = $userService;
|
2014-08-31 14:07:46 +02:00
|
|
|
$this->passwordService = $passwordService;
|
2014-08-31 13:34:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function registerRoutes(\Szurubooru\Router $router)
|
|
|
|
{
|
|
|
|
$router->post('/api/users', [$this, 'create']);
|
|
|
|
$router->get('/api/users', [$this, 'getAll']);
|
|
|
|
$router->get('/api/users/:id', [$this, 'getById']);
|
|
|
|
$router->put('/api/users/:id', [$this, 'update']);
|
|
|
|
$router->delete('/api/users/:id', [$this, 'delete']);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function create()
|
|
|
|
{
|
2014-08-31 14:07:46 +02:00
|
|
|
$this->userService->validateUserName($this->inputReader->userName);
|
|
|
|
$this->passwordService->validatePassword($this->inputReader->password);
|
|
|
|
|
2014-08-31 13:34:31 +02:00
|
|
|
throw new \BadMethodCallException('Not implemented');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function update($id)
|
|
|
|
{
|
|
|
|
throw new \BadMethodCallException('Not implemented');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getAll()
|
|
|
|
{
|
|
|
|
throw new \BadMethodCallException('Not implemented');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getById($id)
|
|
|
|
{
|
|
|
|
throw new \BadMethodCallException('Not implemented');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function delete($id)
|
|
|
|
{
|
|
|
|
throw new \BadMethodCallException('Not implemented');
|
|
|
|
}
|
|
|
|
}
|