This repository has been archived on 2025-02-26. You can view files and clone it, but cannot push or open issues or pull requests.
szurubooru/src/Routes/Scores/SetPostScore.php
2014-11-21 22:16:31 +01:00

45 lines
947 B
PHP

<?php
namespace Szurubooru\Routes\Scores;
use Szurubooru\Entities\Entity;
use Szurubooru\Helpers\InputReader;
use Szurubooru\Services\AuthService;
use Szurubooru\Services\PostService;
use Szurubooru\Services\PrivilegeService;
use Szurubooru\Services\ScoreService;
class SetPostScore extends AbstractScoreRoute
{
private $postService;
public function __construct(
PrivilegeService $privilegeService,
AuthService $authService,
PostService $postService,
ScoreService $scoreService,
InputReader $inputReader)
{
parent::__construct(
$authService,
$inputReader,
$privilegeService,
$scoreService);
$this->postService = $postService;
}
public function getMethods()
{
return ['POST', 'PUT'];
}
public function getUrl()
{
return '/api/posts/:postNameOrId/score';
}
public function work()
{
$post = $this->postService->getByNameOrId($this->getArgument('postNameOrId'));
return $this->setScore($post);
}
}