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/GetCommentScore.php
2014-11-21 22:16:31 +01:00

45 lines
960 B
PHP

<?php
namespace Szurubooru\Routes\Scores;
use Szurubooru\Entities\Entity;
use Szurubooru\Helpers\InputReader;
use Szurubooru\Services\AuthService;
use Szurubooru\Services\CommentService;
use Szurubooru\Services\PrivilegeService;
use Szurubooru\Services\ScoreService;
class GetCommentScore extends AbstractScoreRoute
{
private $commentService;
public function __construct(
PrivilegeService $privilegeService,
AuthService $authService,
CommentService $commentService,
ScoreService $scoreService,
InputReader $inputReader)
{
parent::__construct(
$authService,
$inputReader,
$privilegeService,
$scoreService);
$this->commentService = $commentService;
}
public function getMethods()
{
return ['GET'];
}
public function getUrl()
{
return '/api/comments/:commentId/score';
}
public function work()
{
$comment = $this->commentService->getById($this->getArgument('commentId'));
return $this->getScore($comment);
}
}