Skip to content

fix indention #11517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 49 additions & 49 deletions components/messenger.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ that will do the required processing for your message::

class MyMessageHandler
{
public function __invoke(MyMessage $message)
{
// Message processing...
}
public function __invoke(MyMessage $message)
{
// Message processing...
}
}

Adding Metadata to Messages (Envelopes)
Expand Down Expand Up @@ -215,34 +215,34 @@ First, create your sender::

class ImportantActionToEmailSender implements SenderInterface
{
private $mailer;
private $toEmail;

public function __construct(\Swift_Mailer $mailer, string $toEmail)
{
$this->mailer = $mailer;
$this->toEmail = $toEmail;
}

public function send(Envelope $envelope): Envelope
{
$message = $envelope->getMessage();

if (!$message instanceof ImportantAction) {
throw new \InvalidArgumentException(sprintf('This transport only supports "%s" messages.', ImportantAction::class));
}

$this->mailer->send(
(new \Swift_Message('Important action made'))
->setTo($this->toEmail)
->setBody(
'<h1>Important action</h1><p>Made by '.$message->getUsername().'</p>',
'text/html'
)
);

return $envelope;
}
private $mailer;
private $toEmail;

public function __construct(\Swift_Mailer $mailer, string $toEmail)
{
$this->mailer = $mailer;
$this->toEmail = $toEmail;
}

public function send(Envelope $envelope): Envelope
{
$message = $envelope->getMessage();

if (!$message instanceof ImportantAction) {
throw new \InvalidArgumentException(sprintf('This transport only supports "%s" messages.', ImportantAction::class));
}

$this->mailer->send(
(new \Swift_Message('Important action made'))
->setTo($this->toEmail)
->setBody(
'<h1>Important action</h1><p>Made by '.$message->getUsername().'</p>',
'text/html'
)
);

return $envelope;
}
}

Your own Receiver
Expand Down Expand Up @@ -270,30 +270,30 @@ First, create your receiver::

class NewOrdersFromCsvFileReceiver implements ReceiverInterface
{
private $serializer;
private $filePath;
private $serializer;
private $filePath;

public function __construct(SerializerInterface $serializer, string $filePath)
{
public function __construct(SerializerInterface $serializer, string $filePath)
{
$this->serializer = $serializer;
$this->filePath = $filePath;
}
}

public function receive(callable $handler): void
{
$ordersFromCsv = $this->serializer->deserialize(file_get_contents($this->filePath), 'csv');
public function receive(callable $handler): void
{
$ordersFromCsv = $this->serializer->deserialize(file_get_contents($this->filePath), 'csv');

foreach ($ordersFromCsv as $orderFromCsv) {
$order = new NewOrder($orderFromCsv['id'], $orderFromCsv['account_id'], $orderFromCsv['amount']);
foreach ($ordersFromCsv as $orderFromCsv) {
$order = new NewOrder($orderFromCsv['id'], $orderFromCsv['account_id'], $orderFromCsv['amount']);

$handler(new Envelope($order));
}
}
$handler(new Envelope($order));
}
}

public function stop(): void
{
// noop
}
public function stop(): void
{
// noop
}
}

Receiver and Sender on the same Bus
Expand Down
2 changes: 1 addition & 1 deletion testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ Use the ``submitForm()`` method to submit the form that contains the given butto
$client->request('GET', '/post/hello-world');

$crawler = $client->submitForm('Add comment', [
'comment_form[content]' => '...',
'comment_form[content]' => '...',
]);

The first argument of ``submitForm()`` is the text content, ``id``, ``value`` or
Expand Down