Skip to content

Commit 96cefae

Browse files
committed
Normalize coding style to the whole project
1 parent 4e6c19e commit 96cefae

File tree

83 files changed

+501
-452
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+501
-452
lines changed

.php_cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
$finder = Symfony\CS\Finder::create()
4+
->exclude('Resources')
5+
->in(__DIR__)
6+
;
7+
8+
return Symfony\CS\Config::create()
9+
->finder($finder)
10+
;

Command/MongoDBMigrateMetadataCommand.php

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ protected function initialize(InputInterface $input, OutputInterface $output)
110110
'fsync' => $input->getOption('fsync'),
111111
);
112112

113-
$this->printStatusCallback = function() {};
113+
$this->printStatusCallback = function () {
114+
};
114115
register_tick_function(array($this, 'printStatus'));
115116
}
116117

@@ -128,7 +129,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
128129
}
129130

130131
/**
131-
* Migrate message documents
132+
* Migrate message documents.
132133
*/
133134
private function migrateMessages(OutputInterface $output)
134135
{
@@ -145,10 +146,11 @@ private function migrateMessages(OutputInterface $output)
145146

146147
if (!$numTotal = $cursor->count()) {
147148
$output->writeln('There are no message documents to migrate.');
149+
148150
return;
149151
}
150152

151-
$this->printStatusCallback = function() use ($output, &$numProcessed, $numTotal) {
153+
$this->printStatusCallback = function () use ($output, &$numProcessed, $numTotal) {
152154
$output->write(sprintf("Processed: <info>%d</info> / Complete: <info>%d%%</info>\r", $numProcessed, round(100 * ($numProcessed / $numTotal))));
153155
};
154156

@@ -169,12 +171,12 @@ private function migrateMessages(OutputInterface $output)
169171
}
170172
}
171173

172-
$output->write(str_repeat(' ', 28 + ceil(log10($numProcessed))) . "\r");
174+
$output->write(str_repeat(' ', 28 + ceil(log10($numProcessed)))."\r");
173175
$output->writeln(sprintf('Migrated <info>%d</info> message documents.', $numProcessed));
174176
}
175177

176178
/**
177-
* Migrate thread documents
179+
* Migrate thread documents.
178180
*/
179181
private function migrateThreads(OutputInterface $output)
180182
{
@@ -194,10 +196,11 @@ private function migrateThreads(OutputInterface $output)
194196

195197
if (!$numTotal = $cursor->count()) {
196198
$output->writeln('There are no thread documents to migrate.');
199+
197200
return;
198201
}
199202

200-
$this->printStatusCallback = function() use ($output, &$numProcessed, $numTotal) {
203+
$this->printStatusCallback = function () use ($output, &$numProcessed, $numTotal) {
201204
$output->write(sprintf("Processed: <info>%d</info> / Complete: <info>%d%%</info>\r", $numProcessed, round(100 * ($numProcessed / $numTotal))));
202205
};
203206

@@ -222,7 +225,7 @@ private function migrateThreads(OutputInterface $output)
222225
}
223226
}
224227

225-
$output->write(str_repeat(' ', 28 + ceil(log10($numProcessed))) . "\r");
228+
$output->write(str_repeat(' ', 28 + ceil(log10($numProcessed)))."\r");
226229
$output->writeln(sprintf('Migrated <info>%d</info> thread documents.', $numProcessed));
227230
}
228231

@@ -250,6 +253,7 @@ private function createMessageMetadata(array &$message)
250253
* Sets the unreadForParticipants array on the message.
251254
*
252255
* @see Message::doEnsureUnreadForParticipantsArray()
256+
*
253257
* @param array &$message
254258
*/
255259
private function createMessageUnreadForParticipants(array &$message)
@@ -328,6 +332,7 @@ private function createThreadLastMessageDate(array &$thread)
328332
* Sets the active participant arrays on the thread.
329333
*
330334
* @see Thread::doEnsureActiveParticipantArrays()
335+
*
331336
* @param array $thread
332337
*/
333338
private function createThreadActiveParticipantArrays(array &$thread)
@@ -386,11 +391,13 @@ private function createThreadActiveParticipantArrays(array &$thread)
386391
}
387392

388393
/**
389-
* Get the MongoCollection for the given class
394+
* Get the MongoCollection for the given class.
390395
*
391396
* @param ManagerRegistry $registry
392397
* @param string $class
398+
*
393399
* @return \MongoCollection
400+
*
394401
* @throws \RuntimeException if the class has no DocumentManager
395402
*/
396403
private function getMongoCollectionForClass(ManagerRegistry $registry, $class)
@@ -403,7 +410,7 @@ private function getMongoCollectionForClass(ManagerRegistry $registry, $class)
403410
}
404411

405412
/**
406-
* Invokes the print status callback
413+
* Invokes the print status callback.
407414
*
408415
* Since unregister_tick_function() does not support anonymous functions, it
409416
* is easier to register one method (this) and invoke a dynamic callback.

Composer/Composer.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,27 @@
33
namespace FOS\MessageBundle\Composer;
44

55
use FOS\MessageBundle\ModelManager\MessageManagerInterface;
6-
use FOS\MessageBundle\Sender\SenderInterface;
76
use FOS\MessageBundle\Model\ThreadInterface;
87
use FOS\MessageBundle\ModelManager\ThreadManagerInterface;
98
use FOS\MessageBundle\MessageBuilder\NewThreadMessageBuilder;
109
use FOS\MessageBundle\MessageBuilder\ReplyMessageBuilder;
1110

1211
/**
13-
* Factory for message builders
12+
* Factory for message builders.
1413
*
1514
* @author Thibault Duplessis <thibault.duplessis@gmail.com>
1615
*/
1716
class Composer implements ComposerInterface
1817
{
1918
/**
20-
* Message manager
19+
* Message manager.
2120
*
2221
* @var MessageManagerInterface
2322
*/
2423
protected $messageManager;
2524

2625
/**
27-
* Thread manager
26+
* Thread manager.
2827
*
2928
* @var ThreadManagerInterface
3029
*/
@@ -37,7 +36,7 @@ public function __construct(MessageManagerInterface $messageManager, ThreadManag
3736
}
3837

3938
/**
40-
* Starts composing a message, starting a new thread
39+
* Starts composing a message, starting a new thread.
4140
*
4241
* @return NewThreadMessageBuilder
4342
*/
@@ -50,7 +49,7 @@ public function newThread()
5049
}
5150

5251
/**
53-
* Starts composing a message in a reply to a thread
52+
* Starts composing a message in a reply to a thread.
5453
*
5554
* @return ReplyMessageBuilder
5655
*/

Composer/ComposerInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@
66
use FOS\MessageBundle\Model\ThreadInterface;
77

88
/**
9-
* Factory for message builders
9+
* Factory for message builders.
1010
*
1111
* @author Thibault Duplessis <thibault.duplessis@gmail.com>
1212
*/
1313
interface ComposerInterface
1414
{
1515
/**
16-
* Starts composing a message, starting a new thread
16+
* Starts composing a message, starting a new thread.
1717
*
1818
* @return AbstractMessageBuilder
1919
*/
2020
public function newThread();
2121

2222
/**
23-
* Starts composing a message in a reply to a thread
23+
* Starts composing a message in a reply to a thread.
2424
*
2525
* @return AbstractMessageBuilder
2626
*/

Controller/MessageController.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class MessageController implements ContainerAwareInterface
1616
protected $container;
1717

1818
/**
19-
* Displays the authenticated participant inbox
19+
* Displays the authenticated participant inbox.
2020
*
2121
* @return Response
2222
*/
@@ -25,12 +25,12 @@ public function inboxAction()
2525
$threads = $this->getProvider()->getInboxThreads();
2626

2727
return $this->container->get('templating')->renderResponse('FOSMessageBundle:Message:inbox.html.twig', array(
28-
'threads' => $threads
28+
'threads' => $threads,
2929
));
3030
}
3131

3232
/**
33-
* Displays the authenticated participant messages sent
33+
* Displays the authenticated participant messages sent.
3434
*
3535
* @return Response
3636
*/
@@ -39,12 +39,12 @@ public function sentAction()
3939
$threads = $this->getProvider()->getSentThreads();
4040

4141
return $this->container->get('templating')->renderResponse('FOSMessageBundle:Message:sent.html.twig', array(
42-
'threads' => $threads
42+
'threads' => $threads,
4343
));
4444
}
4545

4646
/**
47-
* Displays the authenticated participant deleted threads
47+
* Displays the authenticated participant deleted threads.
4848
*
4949
* @return Response
5050
*/
@@ -53,12 +53,12 @@ public function deletedAction()
5353
$threads = $this->getProvider()->getDeletedThreads();
5454

5555
return $this->container->get('templating')->renderResponse('FOSMessageBundle:Message:deleted.html.twig', array(
56-
'threads' => $threads
56+
'threads' => $threads,
5757
));
5858
}
5959

6060
/**
61-
* Displays a thread, also allows to reply to it
61+
* Displays a thread, also allows to reply to it.
6262
*
6363
* @param string $threadId the thread id
6464
*
@@ -72,18 +72,18 @@ public function threadAction($threadId)
7272

7373
if ($message = $formHandler->process($form)) {
7474
return new RedirectResponse($this->container->get('router')->generate('fos_message_thread_view', array(
75-
'threadId' => $message->getThread()->getId()
75+
'threadId' => $message->getThread()->getId(),
7676
)));
7777
}
7878

7979
return $this->container->get('templating')->renderResponse('FOSMessageBundle:Message:thread.html.twig', array(
8080
'form' => $form->createView(),
81-
'thread' => $thread
81+
'thread' => $thread,
8282
));
8383
}
8484

8585
/**
86-
* Create a new message thread
86+
* Create a new message thread.
8787
*
8888
* @return Response
8989
*/
@@ -94,18 +94,18 @@ public function newThreadAction()
9494

9595
if ($message = $formHandler->process($form)) {
9696
return new RedirectResponse($this->container->get('router')->generate('fos_message_thread_view', array(
97-
'threadId' => $message->getThread()->getId()
97+
'threadId' => $message->getThread()->getId(),
9898
)));
9999
}
100100

101101
return $this->container->get('templating')->renderResponse('FOSMessageBundle:Message:newThread.html.twig', array(
102102
'form' => $form->createView(),
103-
'data' => $form->getData()
103+
'data' => $form->getData(),
104104
));
105105
}
106106

107107
/**
108-
* Deletes a thread
108+
* Deletes a thread.
109109
*
110110
* @param string $threadId the thread id
111111
*
@@ -119,9 +119,9 @@ public function deleteAction($threadId)
119119

120120
return new RedirectResponse($this->container->get('router')->generate('fos_message_inbox'));
121121
}
122-
122+
123123
/**
124-
* Undeletes a thread
124+
* Undeletes a thread.
125125
*
126126
* @param string $threadId
127127
*
@@ -137,7 +137,7 @@ public function undeleteAction($threadId)
137137
}
138138

139139
/**
140-
* Searches for messages in the inbox and sentbox
140+
* Searches for messages in the inbox and sentbox.
141141
*
142142
* @return Response
143143
*/
@@ -148,12 +148,12 @@ public function searchAction()
148148

149149
return $this->container->get('templating')->renderResponse('FOSMessageBundle:Message:search.html.twig', array(
150150
'query' => $query,
151-
'threads' => $threads
151+
'threads' => $threads,
152152
));
153153
}
154154

155155
/**
156-
* Gets the provider service
156+
* Gets the provider service.
157157
*
158158
* @return ProviderInterface
159159
*/

DataTransformer/RecipientsDataTransformer.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace FOS\MessageBundle\DataTransformer;
34

45
use Symfony\Component\Form\DataTransformerInterface;
@@ -7,8 +8,9 @@
78
use Symfony\Component\Security\Core\User\UserInterface;
89
use Doctrine\Common\Collections\Collection;
910
use Doctrine\Common\Collections\ArrayCollection;
11+
1012
/**
11-
* Transforms collection of UserInterface into strings separated with coma
13+
* Transforms collection of UserInterface into strings separated with coma.
1214
*
1315
* @author Łukasz Pospiech <zocimek@gmail.com>
1416
*/
@@ -25,7 +27,7 @@ public function __construct(DataTransformerInterface $userToUsernameTransformer)
2527
}
2628

2729
/**
28-
* Transforms a collection of recipients into a string
30+
* Transforms a collection of recipients into a string.
2931
*
3032
* @param Collection $recipients
3133
*
@@ -47,12 +49,13 @@ public function transform($recipients)
4749
}
4850

4951
/**
50-
* Transforms a string (usernames) to a Collection of UserInterface
52+
* Transforms a string (usernames) to a Collection of UserInterface.
5153
*
5254
* @param string $usernames
5355
*
5456
* @throws UnexpectedTypeException
5557
* @throws TransformationFailedException
58+
*
5659
* @return Collection $recipients
5760
*/
5861
public function reverseTransform($usernames)

0 commit comments

Comments
 (0)