Skip to content
This repository has been archived by the owner on Feb 6, 2022. It is now read-only.

Commit

Permalink
fixed CS
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Oct 9, 2016
1 parent 6e7292f commit e04de90
Show file tree
Hide file tree
Showing 26 changed files with 124 additions and 109 deletions.
4 changes: 2 additions & 2 deletions Command/NewEmailCommand.php
Expand Up @@ -20,7 +20,7 @@
use Symfony\Component\Console\Question\Question;

/**
* A console command for creating and sending simple emails
* A console command for creating and sending simple emails.
*
* @author Gusakov Nikita <dev@nkt.me>
*/
Expand Down Expand Up @@ -68,7 +68,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$filename = $input->getOption('body');
$content = file_get_contents($filename);
if ($content === false) {
throw new \Exception('Could not get contents from ' . $filename);
throw new \Exception('Could not get contents from '.$filename);
}
$input->setOption('body', $content);
break;
Expand Down
11 changes: 5 additions & 6 deletions DataCollector/MessageDataCollector.php
Expand Up @@ -86,11 +86,10 @@ public function getMailers()
*
* @return array The data of the mailer.
*/

public function getMailerData($name)
{
if (!isset($this->data['mailer'][$name])) {
throw new \LogicException(sprintf("Missing %s data in %s", $name, get_class()));
throw new \LogicException(sprintf('Missing %s data in %s', $name, get_class()));
}

return $this->data['mailer'][$name];
Expand All @@ -109,7 +108,7 @@ public function getMessageCount($name = null)
return $data['messageCount'];
}

return null;
return;
}

/**
Expand All @@ -129,21 +128,21 @@ public function getMessages($name = 'default')
/**
* Returns if the mailer has spool.
*
* @return boolean
* @return bool
*/
public function isSpool($name)
{
if ($data = $this->getMailerData($name)) {
return $data['isSpool'];
}

return null;
return;
}

/**
* Returns if the mailer is the default mailer.
*
* @return boolean
* @return bool
*/
public function isDefaultMailer($name)
{
Expand Down
6 changes: 3 additions & 3 deletions DependencyInjection/Configuration.php
Expand Up @@ -16,7 +16,7 @@
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
* This class contains the configuration information for the bundle
* This class contains the configuration information for the bundle.
*
* This information is solely responsible for how the different configuration
* sections are normalized, and merged.
Expand All @@ -30,7 +30,7 @@ class Configuration implements ConfigurationInterface
/**
* Constructor.
*
* @param Boolean $debug The kernel.debug value
* @param bool $debug The kernel.debug value
*/
public function __construct($debug)
{
Expand Down Expand Up @@ -76,7 +76,7 @@ public function getConfigTreeBuilder()
}

/**
* Return the mailers node
* Return the mailers node.
*
* @return ArrayNodeDefinition
*/
Expand Down
22 changes: 11 additions & 11 deletions DependencyInjection/SwiftmailerExtension.php
Expand Up @@ -85,7 +85,7 @@ protected function configureMailer($name, array $mailer, ContainerBuilder $conta
$mailer['username'] = $parts['user'];
}
if (!empty($parts['pass'])) {
$mailer['password']= $parts['pass'];
$mailer['password'] = $parts['pass'];
}
if (!empty($parts['host'])) {
$mailer['host'] = $parts['host'];
Expand Down Expand Up @@ -149,9 +149,9 @@ protected function configureMailerTransport($name, array $mailer, ContainerBuild
$authDecorator = new DefinitionDecorator('swiftmailer.transport.authhandler.abstract');
$container
->setDefinition(sprintf('swiftmailer.mailer.%s.transport.authhandler', $name), $authDecorator)
->addMethodCall('setUsername', array('%swiftmailer.mailer.' . $name . '.transport.smtp.username%'))
->addMethodCall('setPassword', array('%swiftmailer.mailer.' . $name . '.transport.smtp.password%'))
->addMethodCall('setAuthMode', array('%swiftmailer.mailer.' . $name . '.transport.smtp.auth_mode%'));
->addMethodCall('setUsername', array('%swiftmailer.mailer.'.$name.'.transport.smtp.username%'))
->addMethodCall('setPassword', array('%swiftmailer.mailer.'.$name.'.transport.smtp.password%'))
->addMethodCall('setAuthMode', array('%swiftmailer.mailer.'.$name.'.transport.smtp.auth_mode%'));

$bufferDecorator = new DefinitionDecorator('swiftmailer.transport.buffer.abstract');
$container
Expand All @@ -165,11 +165,11 @@ protected function configureMailerTransport($name, array $mailer, ContainerBuild
array(new Reference(sprintf('swiftmailer.mailer.%s.transport.authhandler', $name))),
new Reference(sprintf('swiftmailer.mailer.%s.transport.eventdispatcher', $name)),
))
->addMethodCall('setHost', array('%swiftmailer.mailer.' . $name . '.transport.smtp.host%'))
->addMethodCall('setPort', array('%swiftmailer.mailer.' . $name . '.transport.smtp.port%'))
->addMethodCall('setEncryption', array('%swiftmailer.mailer.' . $name . '.transport.smtp.encryption%'))
->addMethodCall('setTimeout', array('%swiftmailer.mailer.' . $name . '.transport.smtp.timeout%'))
->addMethodCall('setSourceIp', array('%swiftmailer.mailer.' . $name . '.transport.smtp.source_ip%'))
->addMethodCall('setHost', array('%swiftmailer.mailer.'.$name.'.transport.smtp.host%'))
->addMethodCall('setPort', array('%swiftmailer.mailer.'.$name.'.transport.smtp.port%'))
->addMethodCall('setEncryption', array('%swiftmailer.mailer.'.$name.'.transport.smtp.encryption%'))
->addMethodCall('setTimeout', array('%swiftmailer.mailer.'.$name.'.transport.smtp.timeout%'))
->addMethodCall('setSourceIp', array('%swiftmailer.mailer.'.$name.'.transport.smtp.source_ip%'))
;
$container->setAlias(sprintf('swiftmailer.mailer.%s.transport', $name), sprintf('swiftmailer.mailer.%s.transport.%s', $name, $transport));
} elseif ('sendmail' === $transport) {
Expand All @@ -182,7 +182,7 @@ protected function configureMailerTransport($name, array $mailer, ContainerBuild
->setDefinition(sprintf('swiftmailer.mailer.%s.transport.%s', $name, $transport), $definitionDecorator)
->setArguments(array(
new Reference(sprintf('swiftmailer.mailer.%s.transport.buffer', $name)),
new Reference(sprintf('swiftmailer.mailer.%s.transport.eventdispatcher', $name))
new Reference(sprintf('swiftmailer.mailer.%s.transport.eventdispatcher', $name)),
))
;
$container->setAlias(sprintf('swiftmailer.mailer.%s.transport', $name), sprintf('swiftmailer.mailer.%s.transport.%s', $name, $transport));
Expand Down Expand Up @@ -221,7 +221,7 @@ protected function configureMailerSpool($name, array $mailer, ContainerBuilder $
$container->setAlias(sprintf('swiftmailer.mailer.%s.spool.service', $name), $mailer['spool']['id']);
} else {
foreach (array('path') as $key) {
$container->setParameter(sprintf('swiftmailer.spool.%s.%s.%s', $name, $type, $key), $mailer['spool'][$key] . '/' . $name);
$container->setParameter(sprintf('swiftmailer.spool.%s.%s.%s', $name, $type, $key), $mailer['spool'][$key].'/'.$name);
}
}

Expand Down
3 changes: 1 addition & 2 deletions EventListener/EmailSenderListener.php
Expand Up @@ -13,7 +13,6 @@

use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\IntrospectableContainerInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\Console\ConsoleEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
Expand All @@ -35,7 +34,7 @@ class EmailSenderListener implements EventSubscriberInterface
* Constructor.
*
* @param ContainerInterface $container A ContainerInterface instance
* @param LoggerInterface $logger A LoggerInterface instance
* @param LoggerInterface $logger A LoggerInterface instance
*/
public function __construct(ContainerInterface $container, LoggerInterface $logger = null)
{
Expand Down
1 change: 0 additions & 1 deletion Tests/Command/SendEmailCommandTest.php
Expand Up @@ -3,7 +3,6 @@
namespace Symfony\Bundle\SwiftmailerBundle\Tests\Command;

use Symfony\Bundle\SwiftmailerBundle\Command\SendEmailCommand;
use Symfony\Bundle\SwiftmailerBundle\Tests\TestCase;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerInterface;
Expand Down
3 changes: 2 additions & 1 deletion Tests/DependencyInjection/Fixtures/config/php/antiflood.php
@@ -1,4 +1,5 @@
<?php

$container->loadFromExtension('swiftmailer', array(
'antiflood' => true
'antiflood' => true,
));
1 change: 1 addition & 0 deletions Tests/DependencyInjection/Fixtures/config/php/empty.php
@@ -1,2 +1,3 @@
<?php

$container->loadFromExtension('swiftmailer', array());
23 changes: 12 additions & 11 deletions Tests/DependencyInjection/Fixtures/config/php/full.php
@@ -1,16 +1,17 @@
<?php

$container->loadFromExtension('swiftmailer', array(
'transport' => "smtp",
'username' =>"user",
'password' => "pass",
'host' => "example.org",
'port' => "12345",
'encryption' => "tls",
'auth-mode' => "login",
'timeout' => "1000",
'source_ip' => "127.0.0.1",
'logging' => true,
'transport' => 'smtp',
'username' => 'user',
'password' => 'pass',
'host' => 'example.org',
'port' => '12345',
'encryption' => 'tls',
'auth-mode' => 'login',
'timeout' => '1000',
'source_ip' => '127.0.0.1',
'logging' => true,
'spool' => array('type' => 'memory'),
'delivery_address' => 'single@host.com',
'delivery_address' => 'single@host.com',
'delivery_whitelist' => array('/foo@.*/', '/.*@bar.com$/'),
));
3 changes: 2 additions & 1 deletion Tests/DependencyInjection/Fixtures/config/php/mail.php
@@ -1,4 +1,5 @@
<?php

$container->loadFromExtension('swiftmailer', array(
'transport' => "mail",
'transport' => 'mail',
));
71 changes: 36 additions & 35 deletions Tests/DependencyInjection/Fixtures/config/php/many_mailers.php
@@ -1,64 +1,65 @@
<?php

$container->loadFromExtension('swiftmailer', array(
'default_mailer' => 'secondary_mailer',
'mailers' => array(
'first_mailer' => array(
'transport' => "smtp",
'username' => "user_first",
'password' => "pass_first",
'host' => "example.org",
'port' => "12345",
'encryption' => "tls",
'auth-mode' => "login",
'timeout' => "1000",
'source_ip' => "127.0.0.1",
'logging' => true,
'transport' => 'smtp',
'username' => 'user_first',
'password' => 'pass_first',
'host' => 'example.org',
'port' => '12345',
'encryption' => 'tls',
'auth-mode' => 'login',
'timeout' => '1000',
'source_ip' => '127.0.0.1',
'logging' => true,
'sender_address' => 'first-sender@example.org',
'delivery_address' => 'first@example.org',
'delivery_whitelist' => array(
'/firstfoo@.*/',
'/.*@firstbar.com$/'
'/.*@firstbar.com$/',
),
),
'secondary_mailer' => array(
'transport' => "smtp",
'username' => "user_secondary",
'password' => "pass_secondary",
'host' => "example.org",
'port' => "54321",
'encryption' => "tls",
'auth-mode' => "login",
'timeout' => "1000",
'source_ip' => "127.0.0.1",
'logging' => true,
'spool' => array(
'transport' => 'smtp',
'username' => 'user_secondary',
'password' => 'pass_secondary',
'host' => 'example.org',
'port' => '54321',
'encryption' => 'tls',
'auth-mode' => 'login',
'timeout' => '1000',
'source_ip' => '127.0.0.1',
'logging' => true,
'spool' => array(
'type' => 'memory',
),
'delivery_address' => 'secondary@example.org',
'delivery_whitelist' => array(
'/secondaryfoo@.*/',
'/.*@secondarybar.com$/'
'/.*@secondarybar.com$/',
),
),
'third_mailer' => array(
'transport' => "smtp",
'username' => "user_third",
'password' => "pass_third",
'host' => "example.org",
'port' => "12345",
'encryption' => "tls",
'auth-mode' => "login",
'timeout' => "1000",
'source_ip' => "127.0.0.1",
'logging' => true,
'spool' => array(
'transport' => 'smtp',
'username' => 'user_third',
'password' => 'pass_third',
'host' => 'example.org',
'port' => '12345',
'encryption' => 'tls',
'auth-mode' => 'login',
'timeout' => '1000',
'source_ip' => '127.0.0.1',
'logging' => true,
'spool' => array(
'type' => 'file',
),
'sender_address' => 'third-sender@example.org',
'delivery_address' => 'third@example.org',
'delivery_whitelist' => array(
'/thirdfoo@.*/',
'/.*@thirdbar.com$/'
'/.*@thirdbar.com$/',
),
),
),
Expand Down
3 changes: 2 additions & 1 deletion Tests/DependencyInjection/Fixtures/config/php/null.php
@@ -1,4 +1,5 @@
<?php

$container->loadFromExtension('swiftmailer', array(
'transport' => null
'transport' => null,
));
@@ -1,4 +1,5 @@
<?php

$container->loadFromExtension('swiftmailer', array(
'default_mailer' => 'failover',
'mailers' => array(
Expand Down
19 changes: 10 additions & 9 deletions Tests/DependencyInjection/Fixtures/config/php/one_mailer.php
@@ -1,17 +1,18 @@
<?php

$container->loadFromExtension('swiftmailer', array(
'default_mailer' => 'main_mailer',
'mailers' => array(
'main_mailer' => array(
'transport' => "smtp",
'username' => "user",
'password' => "pass",
'host' => "example.org",
'port' => "12345",
'encryption' => "tls",
'auth-mode' => "login",
'timeout' => "1000",
'source_ip' => "127.0.0.1",
'transport' => 'smtp',
'username' => 'user',
'password' => 'pass',
'host' => 'example.org',
'port' => '12345',
'encryption' => 'tls',
'auth-mode' => 'login',
'timeout' => '1000',
'source_ip' => '127.0.0.1',
),
),
));
3 changes: 2 additions & 1 deletion Tests/DependencyInjection/Fixtures/config/php/redirect.php
@@ -1,5 +1,6 @@
<?php

$container->loadFromExtension('swiftmailer', array(
'delivery_address' => 'single@host.com',
'delivery_address' => 'single@host.com',
'delivery_whitelist' => array('/foo@.*/', '/.*@bar.com$/'),
));
@@ -1,4 +1,5 @@
<?php

$container->loadFromExtension('swiftmailer', array(
'delivery_addresses' => array('first@host.com', 'second@host.com')
'delivery_addresses' => array('first@host.com', 'second@host.com'),
));
@@ -1,5 +1,6 @@
<?php

$container->loadFromExtension('swiftmailer', array(
'delivery_address' => 'single@host.com',
'delivery_address' => 'single@host.com',
'delivery_whitelist' => array('/foo@.*/'),
));
@@ -1,4 +1,5 @@
<?php

$container->loadFromExtension('swiftmailer', array(
'sender_address' => "noreply@test.com",
'sender_address' => 'noreply@test.com',
));
3 changes: 2 additions & 1 deletion Tests/DependencyInjection/Fixtures/config/php/sendmail.php
@@ -1,4 +1,5 @@
<?php

$container->loadFromExtension('swiftmailer', array(
'transport' => "sendmail",
'transport' => 'sendmail',
));

0 comments on commit e04de90

Please sign in to comment.