diff options
author | dartcafe <github@dartcafe.de> | 2020-06-22 21:47:34 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2020-06-22 21:47:34 +0300 |
commit | fd1779a07d81d21f5ba186de522a862693bd3677 (patch) | |
tree | f313dd8f87eb8015961631042b58489f271148b0 /lib/Service | |
parent | 17c03b27e1e0efe74817b3ce622f773a8291bcfd (diff) |
code maintenace
Diffstat (limited to 'lib/Service')
-rw-r--r-- | lib/Service/SubscriptionService.php | 10 | ||||
-rw-r--r-- | lib/Service/VoteService.php | 9 |
2 files changed, 7 insertions, 12 deletions
diff --git a/lib/Service/SubscriptionService.php b/lib/Service/SubscriptionService.php index bca84345..f378e476 100644 --- a/lib/Service/SubscriptionService.php +++ b/lib/Service/SubscriptionService.php @@ -35,29 +35,22 @@ use OCA\Polls\Model\Acl; class SubscriptionService { - private $userId; private $acl; private $subscriptionMapper; private $logger; /** * SubscriptionController constructor. - * @param string $appName - * @param $UserId * @param SubscriptionMapper $subscriptionMapper - * @param IRequest $request * @param ILogger $logger * @param Acl $acl */ public function __construct( - string $appName, - $userId, SubscriptionMapper $subscriptionMapper, ILogger $logger, Acl $acl ) { - $this->userId = $userId; $this->subscriptionMapper = $subscriptionMapper; $this->acl = $acl; $this->logger = $logger; @@ -66,7 +59,7 @@ class SubscriptionService { /** * @NoAdminRequired * @param integer $pollId - * @return DataResponse + * @return array */ public function get($pollId) { if (!$this->acl->setPollId($pollId)->getAllowView()) { @@ -85,6 +78,7 @@ class SubscriptionService { /** * @NoAdminRequired * @param integer $pollId + * @return array */ public function set($pollId, $subscribed) { if (!$this->acl->setPollId($pollId)->getAllowView()) { diff --git a/lib/Service/VoteService.php b/lib/Service/VoteService.php index 739640f9..4df01c70 100644 --- a/lib/Service/VoteService.php +++ b/lib/Service/VoteService.php @@ -25,6 +25,7 @@ namespace OCA\Polls\Service; use Exception; use OCP\AppFramework\Db\DoesNotExistException; +use OCA\Polls\Exceptions\NotAuthorizedException; use OCA\Polls\Db\Vote; use OCA\Polls\Db\VoteMapper; @@ -73,7 +74,7 @@ class VoteService { * @NoAdminRequired * @param integer $pollId * @param string $token - * @return DataResponse + * @return Vote */ public function list($pollId = 0, $token = '') { if (!$this->acl->setPollIdOrToken($pollId, $token)->getAllowView()) { @@ -97,14 +98,14 @@ class VoteService { * @param Array $option * @param string $setTo * @param string $token - * @return DataResponse + * @return Vote */ public function set($pollId = 0, $pollOptionText, $setTo, $token = '') { if (!$this->acl->setPollIdOrToken($pollId, $token)->getAllowVote()) { throw new NotAuthorizedException; } - + $option = $this->optionMapper->findByPollAndText($this->acl->getpollId(), $pollOptionText); try { @@ -136,7 +137,7 @@ class VoteService { * @param integer $voteId * @param string $userId * @param integer $pollId - * @return DataResponse + * @return Vote */ public function delete($pollId, $userId) { |