diff options
author | René Gieling <github@dartcafe.de> | 2017-10-21 15:41:34 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-21 15:41:34 +0300 |
commit | 540e09bcade129f22e2682041dcf4e704385ee79 (patch) | |
tree | 0dc96520deae6a36083dc33f4cceaec40d61a7dc /lib/AppInfo | |
parent | 4788739b6470cebd2ca32b6f74600952738dcfca (diff) |
Code cleaning (#185)
* Update no.acc.tmpl.php
* update for scutinizer
* Update PageController.php
* Update PageController.php
* coding style
* dito
* more fixes
* update
* Added scrutinizer config
* Coding style
Adopting style guide from docs.nextcloud.com
* More changes
* disabled external code coverage
* changes
* Changes
* changes
* changes
* More changes
* Update to version 2.5.11
* Update .scrutinizer.yml
* Update .scrutinizer.yml
* created vendor
[ci skip]
* config
[skip scrutinizer] [skip ci]
* fix
[skip ci]
* Minor
* continuing
[skip ci]
* just a test
* removed unused function declarations
Commenting out some functions, which seem not to be used.
* css tests?
* again
* formatting
* removed comment
and converted spaces in tabs
Diffstat (limited to 'lib/AppInfo')
-rw-r--r-- | lib/AppInfo/Application.php | 253 |
1 files changed, 127 insertions, 126 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 1a561183..810362d7 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -23,6 +23,7 @@ namespace OCA\Polls\AppInfo; + use OC\AppFramework\Utility\SimpleContainer; use OCP\AppFramework\App; use OCA\Polls\Db\CommentMapper; @@ -36,130 +37,130 @@ use OCA\Polls\Controller\PageController; class Application extends App { - /** - * Application constructor. - * @param array $urlParams - */ - public function __construct(array $urlParams = array()) { - parent::__construct('polls', $urlParams); - - $container = $this->getContainer(); - $server = $container->getServer(); - - /** - * Controllers - */ - $container->registerService('PageController', function ($c) use ($server) { - /** @var SimpleContainer $c */ - return new PageController( - $c->query('AppName'), - $c->query('Request'), - $c->query('UserManager'), - $c->query('GroupManager'), - $c->query('AvatarManager'), - $c->query('Logger'), - $c->query('L10N'), - $c->query('ServerContainer')->getURLGenerator(), - $c->query('UserId'), - $c->query('CommentMapper'), - $c->query('DateMapper'), - $c->query('EventMapper'), - $c->query('NotificationMapper'), - $c->query('ParticipationMapper'), - $c->query('ParticipationTextMapper'), - $c->query('TextMapper') - ); - }); - - $container->registerService('UserManager', function ($c) { - /** @var SimpleContainer $c */ - return $c->query('ServerContainer')->getUserManager(); - }); - - $container->registerService('GroupManager', function ($c) { - /** @var SimpleContainer $c */ - return $c->query('ServerContainer')->getGroupManager(); - }); - - $container->registerService('AvatarManager', function ($c) { - /** @var SimpleContainer $c */ - return $c->query('ServerContainer')->getAvatarManager(); - }); - - $container->registerService('Logger', function ($c) { - /** @var SimpleContainer $c */ - return $c->query('ServerContainer')->getLogger(); - }); - - $container->registerService('L10N', function ($c) { - return $c->query('ServerContainer')->getL10N($c->query('AppName')); - }); - - $container->registerService('CommentMapper', function ($c) use ($server) { - /** @var SimpleContainer $c */ - return new CommentMapper( - $server->getDatabaseConnection() - ); - }); - - $container->registerService('DateMapper', function ($c) use ($server) { - /** @var SimpleContainer $c */ - return new DateMapper( - $server->getDatabaseConnection() - ); - }); - - $container->registerService('EventMapper', function ($c) use ($server) { - /** @var SimpleContainer $c */ - return new EventMapper( - $server->getDatabaseConnection() - ); - }); - - $container->registerService('NotificationMapper', function ($c) use ($server) { - /** @var SimpleContainer $c */ - return new NotificationMapper( - $server->getDatabaseConnection() - ); - }); - - $container->registerService('ParticipationMapper', function ($c) use ($server) { - /** @var SimpleContainer $c */ - return new ParticipationMapper( - $server->getDatabaseConnection() - ); - }); - - $container->registerService('ParticipationTextMapper', function ($c) use ($server) { - /** @var SimpleContainer $c */ - return new ParticipationTextMapper( - $server->getDatabaseConnection() - ); - }); - - $container->registerService('TextMapper', function ($c) use ($server) { - /** @var SimpleContainer $c */ - return new TextMapper( - $server->getDatabaseConnection() - ); - }); - } - - /** - * Register navigation entry for main navigation. - */ - public function registerNavigationEntry() { - $container = $this->getContainer(); - $container->query('OCP\INavigationManager')->add(function () use ($container) { - $urlGenerator = $container->query('OCP\IURLGenerator'); - $l10n = $container->query('OCP\IL10N'); - return [ - 'id' => 'polls', - 'order' => 77, - 'href' => $urlGenerator->linkToRoute('polls.page.index'), - 'icon' => $urlGenerator->imagePath('polls', 'app-logo-polls.svg'), - 'name' => $l10n->t('Polls') - ]; - }); - } + /** + * Application constructor. + * @param array $urlParams + */ + public function __construct(array $urlParams = array()) { + parent::__construct('polls', $urlParams); + + $container = $this->getContainer(); + $server = $container->getServer(); + + /** + * Controllers + */ + $container->registerService('PageController', function ($c) use ($server) { + /** @var SimpleContainer $c */ + return new PageController( + $c->query('AppName'), + $c->query('Request'), + $c->query('UserManager'), + $c->query('GroupManager'), + $c->query('AvatarManager'), + $c->query('Logger'), + $c->query('L10N'), + $c->query('ServerContainer')->getURLGenerator(), + $c->query('UserId'), + $c->query('CommentMapper'), + $c->query('DateMapper'), + $c->query('EventMapper'), + $c->query('NotificationMapper'), + $c->query('ParticipationMapper'), + $c->query('ParticipationTextMapper'), + $c->query('TextMapper') + ); + }); + + $container->registerService('UserManager', function ($c) { + /** @var SimpleContainer $c */ + return $c->query('ServerContainer')->getUserManager(); + }); + + $container->registerService('GroupManager', function ($c) { + /** @var SimpleContainer $c */ + return $c->query('ServerContainer')->getGroupManager(); + }); + + $container->registerService('AvatarManager', function ($c) { + /** @var SimpleContainer $c */ + return $c->query('ServerContainer')->getAvatarManager(); + }); + + $container->registerService('Logger', function ($c) { + /** @var SimpleContainer $c */ + return $c->query('ServerContainer')->getLogger(); + }); + + $container->registerService('L10N', function ($c) { + return $c->query('ServerContainer')->getL10N($c->query('AppName')); + }); + + $container->registerService('CommentMapper', function ($c) use ($server) { + /** @var SimpleContainer $c */ + return new CommentMapper( + $server->getDatabaseConnection() + ); + }); + + $container->registerService('DateMapper', function ($c) use ($server) { + /** @var SimpleContainer $c */ + return new DateMapper( + $server->getDatabaseConnection() + ); + }); + + $container->registerService('EventMapper', function ($c) use ($server) { + /** @var SimpleContainer $c */ + return new EventMapper( + $server->getDatabaseConnection() + ); + }); + + $container->registerService('NotificationMapper', function ($c) use ($server) { + /** @var SimpleContainer $c */ + return new NotificationMapper( + $server->getDatabaseConnection() + ); + }); + + $container->registerService('ParticipationMapper', function ($c) use ($server) { + /** @var SimpleContainer $c */ + return new ParticipationMapper( + $server->getDatabaseConnection() + ); + }); + + $container->registerService('ParticipationTextMapper', function ($c) use ($server) { + /** @var SimpleContainer $c */ + return new ParticipationTextMapper( + $server->getDatabaseConnection() + ); + }); + + $container->registerService('TextMapper', function ($c) use ($server) { + /** @var SimpleContainer $c */ + return new TextMapper( + $server->getDatabaseConnection() + ); + }); + } + + /** + * Register navigation entry for main navigation. + */ + public function registerNavigationEntry() { + $container = $this->getContainer(); + $container->query('OCP\INavigationManager')->add(function () use ($container) { + $urlGenerator = $container->query('OCP\IURLGenerator'); + $l10n = $container->query('OCP\IL10N'); + return [ + 'id' => 'polls', + 'order' => 77, + 'href' => $urlGenerator->linkToRoute('polls.page.index'), + 'icon' => $urlGenerator->imagePath('polls', 'app-logo-polls.svg'), + 'name' => $l10n->t('Polls') + ]; + }); + } } |