Passed
Pull Request — develop-0.9 (#315)
by René
03:19
created
tests/Unit/Factories/CommentFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
  */
29 29
 $fm->define('OCA\Polls\Db\Comment')->setDefinitions([
30 30
 	'userId' => Faker::firstNameMale(),
31
-	'dt' => function () {
31
+	'dt' => function() {
32 32
 		$date = new DateTime('today');
33 33
 		return $date->format('Y-m-d H:i:s');
34 34
 	},
Please login to merge, or discard this patch.
tests/Unit/Factories/EventFactory.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@
 block discarded – undo
31 31
 	'title' => Faker::sentence(10),
32 32
 	'description' => Faker::text(255),
33 33
 	'owner' => Faker::firstNameMale(),
34
-	'created' => function () {
34
+	'created' => function() {
35 35
 		$date = new DateTime('today');
36 36
 		return $date->format('Y-m-d H:i:s');
37 37
 	},
38 38
 	'access' => 'registered',
39
-	'expire' => function () {
39
+	'expire' => function() {
40 40
 		$date = new DateTime('tomorrow');
41 41
 		return $date->format('Y-m-d H:i:s');
42 42
 	},
Please login to merge, or discard this patch.
templates/main.tmpl.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 					<div class="table-row table-body">
152 152
 						<div class="wrapper group-master">
153 153
 							<div class="wrapper group-1">
154
-								<div class="thumbnail <?php p($expiry_style . ' ' . $commented_class. ' ' . $participated_class); ?>"></div><!-- Image to display the status or type of poll -->
154
+								<div class="thumbnail <?php p($expiry_style . ' ' . $commented_class . ' ' . $participated_class); ?>"></div><!-- Image to display the status or type of poll -->
155 155
 								<a href="<?php p($pollUrl); ?>" class="wrapper group-1-1">
156 156
 									<div class="flex-column name">						  <?php p($poll->getTitle()); ?></div>
157 157
 									<div class="flex-column description">				   <?php p($poll->getDescription()); ?></div>
@@ -193,10 +193,10 @@  discard block
 block discarded – undo
193 193
 								</div>
194 194
 								<div class="wrapper group-2-1">
195 195
 									<div class="flex-column access"><?php p($l->t($poll->getAccess())); ?></div>
196
-									<div class="flex-column created has-tooltip live-relative-timestamp" data-timestamp="<?php p(strtotime($poll->getCreated())*1000); ?>" data-value="<?php p($poll->getCreated()); ?>"><?php p(\OCP\Template::relative_modified_date(strtotime($poll->getCreated()))); ?></div>
196
+									<div class="flex-column created has-tooltip live-relative-timestamp" data-timestamp="<?php p(strtotime($poll->getCreated()) * 1000); ?>" data-value="<?php p($poll->getCreated()); ?>"><?php p(\OCP\Template::relative_modified_date(strtotime($poll->getCreated()))); ?></div>
197 197
 								</div>
198 198
 								<div class="wrapper group-2-2">
199
-									<div class="flex-column has-tooltip expiry<?php p($expiry_style . $timestamp_style); ?>" data-timestamp="<?php p(strtotime($poll->getExpire())*1000); ?>" data-value="<?php p($poll->getExpire()); ?>"> <?php p($expiry_date); ?></div>
199
+									<div class="flex-column has-tooltip expiry<?php p($expiry_style . $timestamp_style); ?>" data-timestamp="<?php p(strtotime($poll->getExpire()) * 1000); ?>" data-value="<?php p($poll->getExpire()); ?>"> <?php p($expiry_date); ?></div>
200 200
 									<div class="flex-column participants">
201 201
 										<div class="symbol alt-tooltip partic_voted icon-<?php p($participated_class); ?>" title="<?php p($participated_title); ?>"></div>
202 202
 										<div class="symbol alt-tooltip partic_commented icon-<?php p($commented_class); ?>" title="<?php p($commented_title); ?>"></div>
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	}
229 229
 	// Nextcloud >= 12
230 230
 	$groups = \OC::$server->getGroupManager()->getUserGroups(\OC::$server->getUserSession()->getUser());
231
-	return array_map(function ($group) {
231
+	return array_map(function($group) {
232 232
 		return $group->getGID();
233 233
 	}, $groups);
234 234
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -261,8 +261,7 @@
 block discarded – undo
261 261
 					return true;
262 262
 				}
263 263
 			}
264
-		}
265
-		else if (strpos($item, 'user_') === 0) {
264
+		} else if (strpos($item, 'user_') === 0) {
266 265
 			$usr = substr($item, 5);
267 266
 			if ($usr === $userId) {
268 267
 				return true;
Please login to merge, or discard this patch.
templates/goto.tmpl.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 							
272 272
 							if ($class === 'unvoted') {
273 273
 								$dataUnvoted = $l->t('New option!');
274
-								$updatedPoll=true;
274
+								$updatedPoll = true;
275 275
 							}
276 276
 							
277 277
 							print_unescaped('<li id="voteid_' . $optionElement->getId() . '" class="flex-column active poll-cell ' . $class . '" data-value="' . $optionElement->getPollOptionText() . '" data-unvoted="' . $dataUnvoted . '"></li>');
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 			</div>
287 287
 			<?php if ($updatedPoll) : ?>
288 288
 				<div class="updated-poll alert">
289
-				<p> <?php p($l->t('This poll was updated since your last visit. Please check your votes.'));?></p>
289
+				<p> <?php p($l->t('This poll was updated since your last visit. Please check your votes.')); ?></p>
290 290
 				</div>
291 291
 			<?php endif; ?>
292 292
 			
Please login to merge, or discard this patch.
lib/Migration/Version009000Date20171202105141.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 				'notnull' => false,
122 122
 			]);
123 123
 			$table->addColumn('poll_option_text', Type::STRING, [
124
-				'notnull' => false,  // maybe true?
124
+				'notnull' => false, // maybe true?
125 125
 				'length' => 256,
126 126
 			]);
127 127
 			$table->setPrimaryKey(['id']);
@@ -351,8 +351,8 @@  discard block
 block discarded – undo
351 351
 			->from('polls_options')
352 352
 			// ->where($queryFind->expr()->eq('poll_id', $pollId))
353 353
 			// ->andWhere($queryFind->expr()->eq('poll_option', $text));
354
-			->where('poll_id = "'. $pollId .'"')
355
-			->andWhere('poll_option_text ="' .$text .'"');
354
+			->where('poll_id = "' . $pollId . '"')
355
+			->andWhere('poll_option_text ="' . $text . '"');
356 356
 
357 357
 		$resultFind = $queryFind->execute();
358 358
 		$row = $resultFind->fetch();
Please login to merge, or discard this patch.
lib/AppInfo/Application.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		/**
48 48
 		 * Controllers
49 49
 		 */
50
-		$container->registerService('PageController', function (IContainer $c) {
50
+		$container->registerService('PageController', function(IContainer $c) {
51 51
 			return new PageController(
52 52
 				$c->query('AppName'),
53 53
 				$c->query('Request'),
@@ -66,51 +66,51 @@  discard block
 block discarded – undo
66 66
 			);
67 67
 		});
68 68
 
69
-		$container->registerService('UserManager', function (IContainer $c) {
69
+		$container->registerService('UserManager', function(IContainer $c) {
70 70
 			return $c->query('ServerContainer')->getUserManager();
71 71
 		});
72 72
 
73
-		$container->registerService('GroupManager', function (IContainer $c) {
73
+		$container->registerService('GroupManager', function(IContainer $c) {
74 74
 			return $c->query('ServerContainer')->getGroupManager();
75 75
 		});
76 76
 
77
-		$container->registerService('AvatarManager', function (IContainer $c) {
77
+		$container->registerService('AvatarManager', function(IContainer $c) {
78 78
 			return $c->query('ServerContainer')->getAvatarManager();
79 79
 		});
80 80
 
81
-		$container->registerService('Logger', function (IContainer $c) {
81
+		$container->registerService('Logger', function(IContainer $c) {
82 82
 			return $c->query('ServerContainer')->getLogger();
83 83
 		});
84 84
 
85
-		$container->registerService('L10N', function (IContainer $c) {
85
+		$container->registerService('L10N', function(IContainer $c) {
86 86
 			return $c->query('ServerContainer')->getL10N($c->query('AppName'));
87 87
 		});
88 88
 
89
-		$container->registerService('CommentMapper', function (IContainer $c) use ($server) {
89
+		$container->registerService('CommentMapper', function(IContainer $c) use ($server) {
90 90
 			return new CommentMapper(
91 91
 				$server->getDatabaseConnection()
92 92
 			);
93 93
 		});
94 94
 
95
-		$container->registerService('OptionsMapper', function (IContainer $c) use ($server) {
95
+		$container->registerService('OptionsMapper', function(IContainer $c) use ($server) {
96 96
 			return new OptionsMapper(
97 97
 				$server->getDatabaseConnection()
98 98
 			);
99 99
 		});
100 100
 
101
-		$container->registerService('EventMapper', function (IContainer $c) use ($server) {
101
+		$container->registerService('EventMapper', function(IContainer $c) use ($server) {
102 102
 			return new EventMapper(
103 103
 				$server->getDatabaseConnection()
104 104
 			);
105 105
 		});
106 106
 
107
-		$container->registerService('NotificationMapper', function (IContainer $c) use ($server) {
107
+		$container->registerService('NotificationMapper', function(IContainer $c) use ($server) {
108 108
 			return new NotificationMapper(
109 109
 				$server->getDatabaseConnection()
110 110
 			);
111 111
 		});
112 112
 
113
-		$container->registerService('VotesMapper', function (IContainer $c) use ($server) {
113
+		$container->registerService('VotesMapper', function(IContainer $c) use ($server) {
114 114
 			return new VotesMapper(
115 115
 				$server->getDatabaseConnection()
116 116
 			);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function registerNavigationEntry() {
124 124
 		$container = $this->getContainer();
125
-		$container->query('OCP\INavigationManager')->add(function () use ($container) {
125
+		$container->query('OCP\INavigationManager')->add(function() use ($container) {
126 126
 			$urlGenerator = $container->query('OCP\IURLGenerator');
127 127
 			$l10n = $container->query('OCP\IL10N');
128 128
 			return [
Please login to merge, or discard this patch.
lib/Controller/PageController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 			foreach ($optionsArray as $optionElement) {
358 358
 				$option = new Options();
359 359
 				$option->setPollId($pollId);
360
-				$option->setPollOptionText(date('Y-m-d H:i:s', (int)$optionElement));
360
+				$option->setPollOptionText(date('Y-m-d H:i:s', (int) $optionElement));
361 361
 				$this->optionsMapper->insert($option);
362 362
 			}
363 363
 		} else {
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 			foreach ($optionsArray as $optionElement) {
465 465
 				$option = new Options();
466 466
 				$option->setPollId($pollId);
467
-				$option->setPollOptionText(date('Y-m-d H:i:s', (int)$optionElement));
467
+				$option->setPollOptionText(date('Y-m-d H:i:s', (int) $optionElement));
468 468
 				$this->optionsMapper->insert($option);
469 469
 			}
470 470
 		} else {
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 		return new JSONResponse(array(
575 575
 			'userId' => $userId,
576 576
 			'displayName' => $displayName,
577
-			'timeStamp' => $timeStamp *100, 
577
+			'timeStamp' => $timeStamp * 100, 
578 578
 			'date' => date('Y-m-d H:i:s', $timeStamp),
579 579
 			'relativeNow' => $this->trans->t('just now'),
580 580
 			'comment' => $commentBox
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 		}
674 674
 		// Nextcloud >= 12
675 675
 		$groups = $this->groupManager->getUserGroups(\OC::$server->getUserSession()->getUser());
676
-		return array_map(function ($group) {
676
+		return array_map(function($group) {
677 677
 			return $group->getGID();
678 678
 		}, $groups);
679 679
 	}
Please login to merge, or discard this patch.
appinfo/routes.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
  */
23 23
 
24 24
 return [
25
-    'routes' => [
25
+	'routes' => [
26 26
 		['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
27 27
 		['name' => 'page#goto_poll', 'url' => '/poll/{hash}', 'verb' => 'GET'],
28 28
 		['name' => 'page#edit_poll', 'url' => '/edit/{hash}', 'verb' => 'GET'],
Please login to merge, or discard this patch.
lib/Controller/ApiController.php 4 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -74,12 +74,12 @@
 block discarded – undo
74 74
 	}
75 75
 
76 76
   	/**
77
-	 * @NoAdminRequired
78
-	 * @NoCSRFRequired
79
-	 * @PublicPage
80
-	 * @param string $hash
81
-	 * @return JSONResponse
82
-	 */
77
+  	 * @NoAdminRequired
78
+  	 * @NoCSRFRequired
79
+  	 * @PublicPage
80
+  	 * @param string $hash
81
+  	 * @return JSONResponse
82
+  	 */
83 83
 	public function getPoll($hash) {
84 84
 		try {
85 85
 			$poll = $this->eventMapper->findByHash($hash);
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -231,7 +231,7 @@
 block discarded – undo
231 231
 			$this->eventMapper->update($newEvent);
232 232
 			$this->optionsMapper->deleteByPoll($newEvent->getId());
233 233
 			
234
-		} else if ($mode === 'create'){
234
+		} else if ($mode === 'create') {
235 235
 			$newEvent = $this->eventMapper->insert($newEvent);
236 236
 /* 			$ins = $this->eventMapper->insert($newEvent);
237 237
 			$newEvent->setId($ins->getId());
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 			$expiration = true;
134 134
 			$expire = $poll->getExpire();
135 135
 		}
136
-		If ($poll->getOwner() !== $this->userId) {
136
+		if ($poll->getOwner() !== $this->userId) {
137 137
 			$mode = 'create';
138 138
 		} else {
139 139
 			$mode = 'edit';
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 		
179 179
 		$newEvent = new Event();
180 180
 
181
-		If ($mode === 'edit') {
181
+		if ($mode === 'edit') {
182 182
 			// Existing poll shall be edited
183 183
 			$oldPoll = $this->eventMapper->findByHash($event['hash']);
184 184
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 			$this->eventMapper->update($newEvent);
232 232
 			$this->optionsMapper->deleteByPoll($newEvent->getId());
233 233
 			
234
-		} else if ($mode === 'create'){
234
+		} else if ($mode === 'create') {
235 235
 			$newEvent = $this->eventMapper->insert($newEvent);
236 236
 /* 			$ins = $this->eventMapper->insert($newEvent);
237 237
 			$newEvent->setId($ins->getId());
@@ -258,6 +258,6 @@  discard block
 block discarded – undo
258 258
 			}
259 259
 		}
260 260
 
261
-		return new JSONResponse(json_encode($options.pollTexts));
261
+		return new JSONResponse(json_encode($options . pollTexts));
262 262
 	}
263 263
 }
Please login to merge, or discard this patch.