@@ -295,7 +295,7 @@ |
||
| 295 | 295 | /** |
| 296 | 296 | * @NoAdminRequired |
| 297 | 297 | * @return string |
| 298 | - */ |
|
| 298 | + */ |
|
| 299 | 299 | public function getAccessLevel(): string { |
| 300 | 300 | if ($this->getIsOwner()) { |
| 301 | 301 | return 'owner'; |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | public function getGroupShare(): bool { |
| 170 | 170 | return count( |
| 171 | 171 | array_filter($this->shareMapper->findByPoll($this->getPollId()), function($item) { |
| 172 | - if ($item->getType() === 'group' && $this->groupManager->isInGroup($this->getUserId(),$item->getUserId())) { |
|
| 172 | + if ($item->getType() === 'group' && $this->groupManager->isInGroup($this->getUserId(), $item->getUserId())) { |
|
| 173 | 173 | return true; |
| 174 | 174 | } |
| 175 | 175 | }) |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | * @return bool |
| 229 | 229 | */ |
| 230 | 230 | public function getAllowSeeUsernames(): bool { |
| 231 | - return !(($this->event->getIsAnonymous() && !$this->getIsOwner()) || $this->event->getFullAnonymous());; |
|
| 231 | + return !(($this->event->getIsAnonymous() && !$this->getIsOwner()) || $this->event->getFullAnonymous()); ; |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | /** |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | $this->foundByToken = true; |
| 273 | 273 | $this->setPollId($share->getPollId()); |
| 274 | 274 | |
| 275 | - if (($share->getType() === 'group' || $share->getType() === 'user') && !\OC::$server->getUserSession()->isLoggedIn()) { |
|
| 275 | + if (($share->getType() === 'group' || $share->getType() === 'user') && !\OC::$server->getUserSession()->isLoggedIn()) { |
|
| 276 | 276 | // User must be logged in for shareType user and group |
| 277 | 277 | throw DoesNotExistException; |
| 278 | 278 | } else if (($share->getType() === 'group' || $share->getType() === 'public') && \OC::$server->getUserSession()->isLoggedIn()) { |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | - * Anonymizes the participants of a poll |
|
| 49 | - * @NoAdminRequired |
|
| 50 | - * @param Array $array Input list which should be anonymized must be a collection of Vote or Comment |
|
| 51 | - * @return array Returns the original array with anonymized user names |
|
| 52 | - */ |
|
| 48 | + * Anonymizes the participants of a poll |
|
| 49 | + * @NoAdminRequired |
|
| 50 | + * @param Array $array Input list which should be anonymized must be a collection of Vote or Comment |
|
| 51 | + * @return array Returns the original array with anonymized user names |
|
| 52 | + */ |
|
| 53 | 53 | private function anonymize($array) { |
| 54 | 54 | // get mapping for the complete poll |
| 55 | 55 | foreach ($array as &$element) { |
@@ -70,12 +70,12 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
| 73 | - * Initialize anonymizer with pollId and userId |
|
| 74 | - * Creates a mapping list with unique Anonymous strings based on the partcipants of a poll |
|
| 75 | - * @NoAdminRequired |
|
| 76 | - * @param integer $pollId |
|
| 77 | - * @param string $userId - usernames, which will not be anonymized |
|
| 78 | - */ |
|
| 73 | + * Initialize anonymizer with pollId and userId |
|
| 74 | + * Creates a mapping list with unique Anonymous strings based on the partcipants of a poll |
|
| 75 | + * @NoAdminRequired |
|
| 76 | + * @param integer $pollId |
|
| 77 | + * @param string $userId - usernames, which will not be anonymized |
|
| 78 | + */ |
|
| 79 | 79 | |
| 80 | 80 | public function set($pollId, $userId) { |
| 81 | 81 | $this->pollId = $pollId; |
@@ -107,7 +107,7 @@ |
||
| 107 | 107 | } else { |
| 108 | 108 | return false; |
| 109 | 109 | } |
| 110 | - }); |
|
| 110 | + }); |
|
| 111 | 111 | } catch (DoesNotExistException $e) { |
| 112 | 112 | $events = []; |
| 113 | 113 | // return new DataResponse($e, Http::STATUS_NOT_FOUND); |
@@ -230,8 +230,8 @@ |
||
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | $this->event->setOwner($this->userId); |
| 233 | - $this->event->setCreated(date('Y-m-d H:i:s',time())); |
|
| 234 | - $this->logger->error(date('Y-m-d H:i:s',time())); |
|
| 233 | + $this->event->setCreated(date('Y-m-d H:i:s', time())); |
|
| 234 | + $this->logger->error(date('Y-m-d H:i:s', time())); |
|
| 235 | 235 | } finally { |
| 236 | 236 | |
| 237 | 237 | $this->event->setTitle($event['title']); |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | $votes = $this->voteMapper->findParticipantsByPoll($pollId); |
| 172 | 172 | foreach ($votes as $vote) { |
| 173 | - if ($vote->getUserId() !== '' && $vote->getUserId() !== null ) { |
|
| 173 | + if ($vote->getUserId() !== '' && $vote->getUserId() !== null) { |
|
| 174 | 174 | $list[] = [ |
| 175 | 175 | 'id' => $vote->getUserId(), |
| 176 | 176 | 'user' => $vote->getUserId(), |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | $shares = $this->shareMapper->findByPoll($pollId); |
| 184 | 184 | foreach ($shares as $share) { |
| 185 | - if ($share->getUserId() !== '' && $share->getUserId() !== null ) { |
|
| 185 | + if ($share->getUserId() !== '' && $share->getUserId() !== null) { |
|
| 186 | 186 | $list[] = [ |
| 187 | 187 | 'id' => $share->getUserId(), |
| 188 | 188 | 'user' => $share->getUserId(), |
@@ -52,11 +52,11 @@ |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | - * Read acl with poll id for current user |
|
| 56 | - * @NoAdminRequired |
|
| 57 | - * @param integer $pollId |
|
| 58 | - * @return array |
|
| 59 | - */ |
|
| 55 | + * Read acl with poll id for current user |
|
| 56 | + * @NoAdminRequired |
|
| 57 | + * @param integer $pollId |
|
| 58 | + * @return array |
|
| 59 | + */ |
|
| 60 | 60 | public function get($id) { |
| 61 | 61 | $acl = $this->acl->setPollId($id); |
| 62 | 62 | // $acl = $this->acl->setUserId('dartcafe'); |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | class ShareController extends Controller { |
| 48 | 48 | |
| 49 | - private $logger; |
|
| 50 | - private $acl; |
|
| 49 | + private $logger; |
|
| 50 | + private $acl; |
|
| 51 | 51 | private $mapper; |
| 52 | 52 | private $userId; |
| 53 | 53 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | Acl $acl |
| 75 | 75 | ) { |
| 76 | 76 | parent::__construct($appName, $request); |
| 77 | - $this->logger = $logger; |
|
| 77 | + $this->logger = $logger; |
|
| 78 | 78 | $this->userId = $userId; |
| 79 | 79 | $this->mapper = $mapper; |
| 80 | 80 | $this->eventMapper = $eventMapper; |
@@ -83,14 +83,14 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | - * getByToken |
|
| 87 | - * Get pollId by token |
|
| 88 | - * @NoAdminRequired |
|
| 89 | - * @NoCSRFRequired |
|
| 90 | - * @PublicPage |
|
| 91 | - * @param string $token |
|
| 92 | - * @return DataResponse |
|
| 93 | - */ |
|
| 86 | + * getByToken |
|
| 87 | + * Get pollId by token |
|
| 88 | + * @NoAdminRequired |
|
| 89 | + * @NoCSRFRequired |
|
| 90 | + * @PublicPage |
|
| 91 | + * @param string $token |
|
| 92 | + * @return DataResponse |
|
| 93 | + */ |
|
| 94 | 94 | public function get($token) { |
| 95 | 95 | try { |
| 96 | 96 | $share = $this->mapper->findByToken($token); |
@@ -205,7 +205,7 @@ |
||
| 205 | 205 | )); |
| 206 | 206 | |
| 207 | 207 | } else { |
| 208 | - return new DataResponse('Wrong share type: ' .$userShare->getType() , Http::STATUS_FORBIDDEN); |
|
| 208 | + return new DataResponse('Wrong share type: ' . $userShare->getType(), Http::STATUS_FORBIDDEN); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | |
@@ -151,7 +151,7 @@ |
||
| 151 | 151 | |
| 152 | 152 | /** |
| 153 | 153 | * Public functions |
| 154 | - */ |
|
| 154 | + */ |
|
| 155 | 155 | |
| 156 | 156 | /** |
| 157 | 157 | * getByToken |
@@ -7,30 +7,30 @@ |
||
| 7 | 7 | |
| 8 | 8 | class FactoryMuffin extends OriginalFactoryMuffin |
| 9 | 9 | { |
| 10 | - /** |
|
| 11 | - * Generate and set the model attributes. |
|
| 12 | - * NOTE: Patch the original method to support dynamic setter and getter |
|
| 13 | - * of the OCP\AppFramework\Db\Entity class |
|
| 14 | - * |
|
| 15 | - * @param object $model The model instance. |
|
| 16 | - * @param array $attr The model attributes. |
|
| 17 | - * |
|
| 18 | - * @return void |
|
| 19 | - */ |
|
| 20 | - protected function generate($model, array $attr = []) |
|
| 21 | - { |
|
| 22 | - foreach ($attr as $key => $kind) { |
|
| 23 | - $value = $this->factory->generate($kind, $model, $this); |
|
| 10 | + /** |
|
| 11 | + * Generate and set the model attributes. |
|
| 12 | + * NOTE: Patch the original method to support dynamic setter and getter |
|
| 13 | + * of the OCP\AppFramework\Db\Entity class |
|
| 14 | + * |
|
| 15 | + * @param object $model The model instance. |
|
| 16 | + * @param array $attr The model attributes. |
|
| 17 | + * |
|
| 18 | + * @return void |
|
| 19 | + */ |
|
| 20 | + protected function generate($model, array $attr = []) |
|
| 21 | + { |
|
| 22 | + foreach ($attr as $key => $kind) { |
|
| 23 | + $value = $this->factory->generate($kind, $model, $this); |
|
| 24 | 24 | |
| 25 | - $setter = 'set'.ucfirst(static::camelize($key)); |
|
| 26 | - // check if there is a setter and use it instead |
|
| 27 | - if ($model instanceof Entity && is_callable([$model, $setter])) { |
|
| 28 | - $model->$setter($value); |
|
| 29 | - } elseif (method_exists($model, $setter) && is_callable([$model, $setter])) { |
|
| 30 | - $model->$setter($value); |
|
| 31 | - } else { |
|
| 32 | - $model->$key = $value; |
|
| 33 | - } |
|
| 34 | - } |
|
| 35 | - } |
|
| 25 | + $setter = 'set'.ucfirst(static::camelize($key)); |
|
| 26 | + // check if there is a setter and use it instead |
|
| 27 | + if ($model instanceof Entity && is_callable([$model, $setter])) { |
|
| 28 | + $model->$setter($value); |
|
| 29 | + } elseif (method_exists($model, $setter) && is_callable([$model, $setter])) { |
|
| 30 | + $model->$setter($value); |
|
| 31 | + } else { |
|
| 32 | + $model->$key = $value; |
|
| 33 | + } |
|
| 34 | + } |
|
| 35 | + } |
|
| 36 | 36 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | foreach ($attr as $key => $kind) { |
| 23 | 23 | $value = $this->factory->generate($kind, $model, $this); |
| 24 | 24 | |
| 25 | - $setter = 'set'.ucfirst(static::camelize($key)); |
|
| 25 | + $setter = 'set' . ucfirst(static::camelize($key)); |
|
| 26 | 26 | // check if there is a setter and use it instead |
| 27 | 27 | if ($model instanceof Entity && is_callable([$model, $setter])) { |
| 28 | 28 | $model->$setter($value); |
@@ -5,8 +5,7 @@ discard block |
||
| 5 | 5 | use League\FactoryMuffin\FactoryMuffin as OriginalFactoryMuffin; |
| 6 | 6 | use OCP\AppFramework\Db\Entity; |
| 7 | 7 | |
| 8 | -class FactoryMuffin extends OriginalFactoryMuffin |
|
| 9 | -{ |
|
| 8 | +class FactoryMuffin extends OriginalFactoryMuffin { |
|
| 10 | 9 | /** |
| 11 | 10 | * Generate and set the model attributes. |
| 12 | 11 | * NOTE: Patch the original method to support dynamic setter and getter |
@@ -17,8 +16,7 @@ discard block |
||
| 17 | 16 | * |
| 18 | 17 | * @return void |
| 19 | 18 | */ |
| 20 | - protected function generate($model, array $attr = []) |
|
| 21 | - { |
|
| 19 | + protected function generate($model, array $attr = []) { |
|
| 22 | 20 | foreach ($attr as $key => $kind) { |
| 23 | 21 | $value = $this->factory->generate($kind, $model, $this); |
| 24 | 22 | |