This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
This commit is contained in:
Scrutinizer Auto-Fixer 2018-05-03 17:28:35 +00:00
Родитель ac7765a37c
Коммит 74e880d407
9 изменённых файлов: 39 добавлений и 40 удалений

Просмотреть файл

@ -22,7 +22,7 @@
*/
return [
'routes' => [
'routes' => [
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
['name' => 'page#goto_poll', 'url' => '/poll/{hash}', 'verb' => 'GET'],
['name' => 'page#edit_poll', 'url' => '/edit/{hash}', 'verb' => 'GET'],

Просмотреть файл

@ -47,7 +47,7 @@ class Application extends App {
/**
* Controllers
*/
$container->registerService('PageController', function (IContainer $c) {
$container->registerService('PageController', function(IContainer $c) {
return new PageController(
$c->query('AppName'),
$c->query('Request'),
@ -66,51 +66,51 @@ class Application extends App {
);
});
$container->registerService('UserManager', function (IContainer $c) {
$container->registerService('UserManager', function(IContainer $c) {
return $c->query('ServerContainer')->getUserManager();
});
$container->registerService('GroupManager', function (IContainer $c) {
$container->registerService('GroupManager', function(IContainer $c) {
return $c->query('ServerContainer')->getGroupManager();
});
$container->registerService('AvatarManager', function (IContainer $c) {
$container->registerService('AvatarManager', function(IContainer $c) {
return $c->query('ServerContainer')->getAvatarManager();
});
$container->registerService('Logger', function (IContainer $c) {
$container->registerService('Logger', function(IContainer $c) {
return $c->query('ServerContainer')->getLogger();
});
$container->registerService('L10N', function (IContainer $c) {
$container->registerService('L10N', function(IContainer $c) {
return $c->query('ServerContainer')->getL10N($c->query('AppName'));
});
$container->registerService('CommentMapper', function (IContainer $c) use ($server) {
$container->registerService('CommentMapper', function(IContainer $c) use ($server) {
return new CommentMapper(
$server->getDatabaseConnection()
);
});
$container->registerService('OptionsMapper', function (IContainer $c) use ($server) {
$container->registerService('OptionsMapper', function(IContainer $c) use ($server) {
return new OptionsMapper(
$server->getDatabaseConnection()
);
});
$container->registerService('EventMapper', function (IContainer $c) use ($server) {
$container->registerService('EventMapper', function(IContainer $c) use ($server) {
return new EventMapper(
$server->getDatabaseConnection()
);
});
$container->registerService('NotificationMapper', function (IContainer $c) use ($server) {
$container->registerService('NotificationMapper', function(IContainer $c) use ($server) {
return new NotificationMapper(
$server->getDatabaseConnection()
);
});
$container->registerService('VotesMapper', function (IContainer $c) use ($server) {
$container->registerService('VotesMapper', function(IContainer $c) use ($server) {
return new VotesMapper(
$server->getDatabaseConnection()
);
@ -122,7 +122,7 @@ class Application extends App {
*/
public function registerNavigationEntry() {
$container = $this->getContainer();
$container->query('OCP\INavigationManager')->add(function () use ($container) {
$container->query('OCP\INavigationManager')->add(function() use ($container) {
$urlGenerator = $container->query('OCP\IURLGenerator');
$l10n = $container->query('OCP\IL10N');
return [

Просмотреть файл

@ -74,12 +74,12 @@ class ApiController extends Controller {
}
/**
* @NoAdminRequired
* @NoCSRFRequired
* @PublicPage
* @param string $hash
* @return JSONResponse
*/
* @NoAdminRequired
* @NoCSRFRequired
* @PublicPage
* @param string $hash
* @return JSONResponse
*/
public function getPoll($hash) {
try {
$poll = $this->eventMapper->findByHash($hash);
@ -134,7 +134,7 @@ class ApiController extends Controller {
$expiration = true;
$expire = $poll->getExpire();
}
If ($poll->getOwner() !== $this->userId) {
if ($poll->getOwner() !== $this->userId) {
$mode = 'create';
} else {
$mode = 'edit';
@ -179,7 +179,7 @@ class ApiController extends Controller {
$newEvent = new Event();
If ($mode === 'edit') {
if ($mode === 'edit') {
// Existing poll shall be edited
$oldPoll = $this->eventMapper->findByHash($event['hash']);
@ -232,7 +232,7 @@ class ApiController extends Controller {
$this->eventMapper->update($newEvent);
$this->optionsMapper->deleteByPoll($newEvent->getId());
} else if ($mode === 'create'){
} else if ($mode === 'create') {
$newEvent = $this->eventMapper->insert($newEvent);
/* $ins = $this->eventMapper->insert($newEvent);
$newEvent->setId($ins->getId());

Просмотреть файл

@ -347,7 +347,7 @@ class PageController extends Controller {
foreach ($optionsArray as $optionElement) {
$option = new Options();
$option->setPollId($pollId);
$option->setPollOptionText(date('Y-m-d H:i:s', (int)$optionElement));
$option->setPollOptionText(date('Y-m-d H:i:s', (int) $optionElement));
$this->optionsMapper->insert($option);
}
} else {
@ -454,7 +454,7 @@ class PageController extends Controller {
foreach ($optionsArray as $optionElement) {
$option = new Options();
$option->setPollId($pollId);
$option->setPollOptionText(date('Y-m-d H:i:s', (int)$optionElement));
$option->setPollOptionText(date('Y-m-d H:i:s', (int) $optionElement));
$this->optionsMapper->insert($option);
}
} else {
@ -557,7 +557,7 @@ class PageController extends Controller {
return new JSONResponse(array(
'userId' => $userId,
'displayName' => $displayName,
'timeStamp' => $timeStamp *100,
'timeStamp' => $timeStamp * 100,
'date' => date('Y-m-d H:i:s', $timeStamp),
'relativeNow' => $this->trans->t('just now'),
'comment' => $commentBox
@ -656,7 +656,7 @@ class PageController extends Controller {
}
// Nextcloud >= 12
$groups = $this->groupManager->getUserGroups(\OC::$server->getUserSession()->getUser());
return array_map(function ($group) {
return array_map(function($group) {
return $group->getGID();
}, $groups);
}

Просмотреть файл

@ -122,7 +122,7 @@ class Version009000Date20171202105141 extends SimpleMigrationStep {
'notnull' => false,
]);
$table->addColumn('poll_option_text', Type::STRING, [
'notnull' => false, // maybe true?
'notnull' => false, // maybe true?
'length' => 256,
]);
$table->setPrimaryKey(['id']);
@ -352,8 +352,8 @@ class Version009000Date20171202105141 extends SimpleMigrationStep {
->from('polls_options')
// ->where($queryFind->expr()->eq('poll_id', $pollId))
// ->andWhere($queryFind->expr()->eq('poll_option', $text));
->where('poll_id = "'. $pollId .'"')
->andWhere('poll_option_text ="' .$text .'"');
->where('poll_id = "' . $pollId . '"')
->andWhere('poll_option_text ="' . $text . '"');
$resultFind = $queryFind->execute();
$row = $resultFind->fetch();

Просмотреть файл

@ -276,7 +276,7 @@
if ($class === 'unvoted') {
$dataUnvoted = $l->t('New option!');
$updatedPoll=true;
$updatedPoll = true;
}
print_unescaped('<li id="voteid_' . $optionElement->getId() . '" class="flex-column active poll-cell ' . $class . '" data-value="' . $optionElement->getPollOptionText() . '" data-unvoted="' . $dataUnvoted . '"></li>');
@ -291,7 +291,7 @@
</div>
<?php if ($updatedPoll) : ?>
<div class="updated-poll alert">
<p> <?php p($l->t('This poll was updated since your last visit. Please check your votes.'));?></p>
<p> <?php p($l->t('This poll was updated since your last visit. Please check your votes.')); ?></p>
</div>
<?php endif; ?>

Просмотреть файл

@ -147,7 +147,7 @@
<div class="table-row table-body">
<div class="wrapper group-master">
<div class="wrapper group-1">
<div class="thumbnail <?php p($expiry_style . ' ' . $commented_class. ' ' . $participated_class); ?>"></div><!-- Image to display the status or type of poll -->
<div class="thumbnail <?php p($expiry_style . ' ' . $commented_class . ' ' . $participated_class); ?>"></div><!-- Image to display the status or type of poll -->
<a href="<?php p($pollUrl); ?>" class="wrapper group-1-1">
<div class="flex-column name"> <?php p($poll->getTitle()); ?></div>
<div class="flex-column description"> <?php p($poll->getDescription()); ?></div>
@ -189,10 +189,10 @@
</div>
<div class="wrapper group-2-1">
<div class="flex-column access"><?php p($l->t($poll->getAccess())); ?></div>
<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>
<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>
</div>
<div class="wrapper group-2-2">
<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>
<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>
<div class="flex-column participants">
<div class="symbol alt-tooltip partic_voted icon-<?php p($participated_class); ?>" title="<?php p($participated_title); ?>"></div>
<div class="symbol alt-tooltip partic_commented icon-<?php p($commented_class); ?>" title="<?php p($commented_title); ?>"></div>
@ -224,7 +224,7 @@ function getGroups($userId) {
}
// Nextcloud >= 12
$groups = \OC::$server->getGroupManager()->getUserGroups(\OC::$server->getUserSession()->getUser());
return array_map(function ($group) {
return array_map(function($group) {
return $group->getGID();
}, $groups);
}
@ -261,8 +261,7 @@ function userHasAccess(OCA\Polls\Db\Event $poll, $userId) {
return true;
}
}
}
else if (strpos($item, 'user_') === 0) {
} else if (strpos($item, 'user_') === 0) {
$usr = substr($item, 5);
if ($usr === $userId) {
return true;

Просмотреть файл

@ -28,7 +28,7 @@ use League\FactoryMuffin\Faker\Facade as Faker;
*/
$fm->define('OCA\Polls\Db\Comment')->setDefinitions([
'userId' => Faker::firstNameMale(),
'dt' => function () {
'dt' => function() {
$date = new DateTime('today');
return $date->format('Y-m-d H:i:s');
},

Просмотреть файл

@ -31,12 +31,12 @@ $fm->define('OCA\Polls\Db\Event')->setDefinitions([
'title' => Faker::sentence(10),
'description' => Faker::text(255),
'owner' => Faker::firstNameMale(),
'created' => function () {
'created' => function() {
$date = new DateTime('today');
return $date->format('Y-m-d H:i:s');
},
'access' => 'registered',
'expire' => function () {
'expire' => function() {
$date = new DateTime('tomorrow');
return $date->format('Y-m-d H:i:s');
},