From cedd924e317c6345dd813cc44573922b198a4bb9 Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 13 Aug 2013 17:28:32 +0200 Subject: [PATCH] Fixed codestyle --- .../Phrasea/Controller/Admin/Publications.php | 2 -- lib/Alchemy/Phrasea/Controller/Prod/Feed.php | 20 ++++++++++--------- lib/Alchemy/Phrasea/Feed/Aggregate.php | 6 +++--- lib/Alchemy/Phrasea/Feed/FeedInterface.php | 6 +++--- lib/Doctrine/Entities/Feed.php | 7 +++---- .../Repositories/AggregateTokenRepository.php | 9 +++++++++ .../Repositories/FeedTokenRepository.php | 9 +++++++++ .../Repositories/OrderElementRepository.php | 9 +++++++++ .../Repositories/SessionModuleRepository.php | 9 +++++++++ .../Repositories/SessionRepository.php | 9 +++++++++ .../Repositories/UserSettingRepository.php | 9 +++++++++ lib/classes/eventsmanager/notify/feed.php | 1 - 12 files changed, 74 insertions(+), 22 deletions(-) diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Publications.php b/lib/Alchemy/Phrasea/Controller/Admin/Publications.php index afc5520f9a..6e62116fbc 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Publications.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Publications.php @@ -37,7 +37,6 @@ class Publications implements ControllerProviderInterface }); $controllers->get('/list/', function(PhraseaApplication $app) { - $feeds = $app['EM']->getRepository('Entities\Feed')->getAllForUser( $app['authentication']->getUser() ); @@ -47,7 +46,6 @@ class Publications implements ControllerProviderInterface })->bind('admin_feeds_list'); $controllers->post('/create/', function(PhraseaApplication $app, Request $request) { - if ('' === $title = trim($request->request->get('title', ''))) { $app->abort(400, "Bad request"); } diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Feed.php b/lib/Alchemy/Phrasea/Controller/Prod/Feed.php index 690b126336..a2858c9756 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Feed.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Feed.php @@ -134,7 +134,7 @@ class Feed implements ControllerProviderInterface $app->abort(403, 'Unathorized action'); } if ('' === $title = trim($request->request->get('title', ''))) { - $app->abort(400, "Bad request"); + $app->abort(400, "Bad request"); } $entry->setAuthorEmail($request->request->get('author_mail')) @@ -215,13 +215,11 @@ class Feed implements ControllerProviderInterface $feeds = $app['EM']->getRepository('Entities\Feed')->getAllForUser($app['authentication']->getUser()); - $datas = $app['twig']->render('prod/feeds/feeds.html.twig' - , array( - 'feeds' => $feeds - , 'feed' => new Aggregate($app['EM'], $feeds) - , 'page' => $page - ) - ); + $datas = $app['twig']->render('prod/feeds/feeds.html.twig', array( + 'feeds' => $feeds, + 'feed' => new Aggregate($app['EM'], $feeds), + 'page' => $page + )); return new Response($datas); })->bind('prod_feeds'); @@ -247,7 +245,11 @@ class Feed implements ControllerProviderInterface $aggregate = new Aggregate($app['EM'], $feeds); - $link = $app['feed.aggregate-link-generator']->generate($aggregate, $app['authentication']->getUser(), AggregateLinkGenerator::FORMAT_RSS, null, $renew); + $link = $app['feed.aggregate-link-generator']->generate($aggregate, + $app['authentication']->getUser(), + AggregateLinkGenerator::FORMAT_RSS, + null, $renew + ); $output = array( 'texte' => '

' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.') diff --git a/lib/Alchemy/Phrasea/Feed/Aggregate.php b/lib/Alchemy/Phrasea/Feed/Aggregate.php index ea83dab3c2..11572d3366 100644 --- a/lib/Alchemy/Phrasea/Feed/Aggregate.php +++ b/lib/Alchemy/Phrasea/Feed/Aggregate.php @@ -204,14 +204,14 @@ class Aggregate implements FeedInterface /** * {@inheritdoc} */ - public function hasPage($page, $pageSize) + public function hasPage($pageNumber, $nbEntriesByPage) { - if (0 >= $pageSize) { + if (0 >= $nbEntriesByPage) { throw new LogicException; } $count = $this->getCountTotalEntries(); - if (0 > $page && $page <= $count / $pageSize) { + if (0 > $pageNumber && $pageNumber <= $count / $nbEntriesByPage) { return true; } diff --git a/lib/Alchemy/Phrasea/Feed/FeedInterface.php b/lib/Alchemy/Phrasea/Feed/FeedInterface.php index 3780f31a26..caf4a7db5c 100644 --- a/lib/Alchemy/Phrasea/Feed/FeedInterface.php +++ b/lib/Alchemy/Phrasea/Feed/FeedInterface.php @@ -68,10 +68,10 @@ interface FeedInterface /** * Returns a boolean indicating whether the feed has a given page. * - * @param integer $page - * @param integer $pageSize + * @param integer $pageNumber + * @param integer $nbEntriesByPage * * @return \DateTime */ - public function hasPage($page, $pageSize); + public function hasPage($pageNumber, $nbEntriesByPage); } diff --git a/lib/Doctrine/Entities/Feed.php b/lib/Doctrine/Entities/Feed.php index 5d17381901..b8bc4078f8 100644 --- a/lib/Doctrine/Entities/Feed.php +++ b/lib/Doctrine/Entities/Feed.php @@ -531,14 +531,13 @@ class Feed implements FeedInterface * * @return boolean */ - public function hasPage($page, $pageSize) + public function hasPage($pageNumber, $nbEntriesByPage) { - if (0 >= $pageSize) { + if (0 >= $nbEntriesByPage) { throw new LogicException; } - $count = $this->getCountTotalEntries(); - if (0 > $page && $page <= $count / $pageSize) { + if (0 > $pageNumber && $pageNumber <= $count / $nbEntriesByPage) { return true; } diff --git a/lib/Doctrine/Repositories/AggregateTokenRepository.php b/lib/Doctrine/Repositories/AggregateTokenRepository.php index a84ddd5b0a..7e104f3a42 100644 --- a/lib/Doctrine/Repositories/AggregateTokenRepository.php +++ b/lib/Doctrine/Repositories/AggregateTokenRepository.php @@ -1,5 +1,14 @@ broker->notify($user_to_notif->get_id(), __CLASS__, $datas, $mailed); - } $start += $perLoop; } while (count($results) > 0);