diff --git a/.php_cs b/.php_cs index 8605612..d6408b9 100644 --- a/.php_cs +++ b/.php_cs @@ -1,22 +1,26 @@ in(__DIR__) - ->exclude('spec') - ->exclude('vendor') -; - return Symfony\CS\Config\Config::create() - ->setUsingCache(true) - ->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL) - ->fixers([ + ->fixers(array( 'align_double_arrow', 'align_equals', 'concat_with_spaces', - 'logical_not_operators_with_spaces', - 'newline_after_open_tag', + 'line_break_between_statements', + 'no_empty_comment', + 'no_useless_return', 'ordered_use', + 'php_unit_construct', + 'php_unit_strict', 'phpdoc_order', - ]) - ->finder($finder) + 'phpspec', + 'short_array_syntax', + 'strict_param', + )) + ->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL) + ->addCustomFixer(new PedroTroller\CS\Fixer\Contrib\LineBreakBetweenStatementsFixer()) + ->addCustomFixer(new PedroTroller\CS\Fixer\Contrib\PhpspecFixer()) + ->finder(Symfony\CS\Finder\DefaultFinder::create() + ->in('spec') + ->in('src') + ) ; diff --git a/README.md b/README.md index 7f385d8..e4ce868 100644 --- a/README.md +++ b/README.md @@ -1 +1,11 @@ -#UniMail +#UniMail - It's realy simple to send emails with Symfony + +#Email definition + +You have to define your email via the configuration. + +```yaml +knp_unimail: + mails: + user.activation: #This the mail name + from: '%mailer_from%' #This is the mail sender diff --git a/composer.json b/composer.json index 67533fc..5ce0063 100644 --- a/composer.json +++ b/composer.json @@ -8,6 +8,7 @@ } ], "require": { + "php": ">=5.4", "doctrine/collections": "~1.0", "swiftmailer/swiftmailer": "~5.0", "symfony/config": "~2.4", @@ -19,6 +20,7 @@ }, "require-dev": { "knplabs/phpspec-welldone-extension": "~1.0", + "pedrotroller/php-cs-custom-fixer": "^1.5", "phpspec/phpspec": "^2.3" }, "autoload": { @@ -27,7 +29,8 @@ } }, "config": { - "bin-dir": "bin" + "bin-dir": "bin", + "sort-packages": true }, "extra": { "branch-alias": { diff --git a/spec/Knp/UniMail/AttachmentFactory/LocalAttachmentFactorySpec.php b/spec/Knp/UniMail/AttachmentFactory/LocalAttachmentFactorySpec.php index a2f79bc..d43ba05 100644 --- a/spec/Knp/UniMail/AttachmentFactory/LocalAttachmentFactorySpec.php +++ b/spec/Knp/UniMail/AttachmentFactory/LocalAttachmentFactorySpec.php @@ -3,7 +3,6 @@ namespace spec\Knp\Rad\Mailer\AttachmentFactory; use PhpSpec\ObjectBehavior; -use Prophecy\Argument; class LocalAttachmentFactorySpec extends ObjectBehavior { diff --git a/spec/Knp/UniMail/AttachmentFactory/RemoteAttachmentFactorySpec.php b/spec/Knp/UniMail/AttachmentFactory/RemoteAttachmentFactorySpec.php index 8981497..09ab071 100644 --- a/spec/Knp/UniMail/AttachmentFactory/RemoteAttachmentFactorySpec.php +++ b/spec/Knp/UniMail/AttachmentFactory/RemoteAttachmentFactorySpec.php @@ -3,7 +3,6 @@ namespace spec\Knp\Rad\Mailer\AttachmentFactory; use PhpSpec\ObjectBehavior; -use Prophecy\Argument; class RemoteAttachmentFactorySpec extends ObjectBehavior { diff --git a/spec/Knp/UniMail/MailFactory/ConfigurationAwareFactorySpec.php b/spec/Knp/UniMail/MailFactory/ConfigurationAwareFactorySpec.php index f4a1798..0e074f8 100644 --- a/spec/Knp/UniMail/MailFactory/ConfigurationAwareFactorySpec.php +++ b/spec/Knp/UniMail/MailFactory/ConfigurationAwareFactorySpec.php @@ -5,7 +5,6 @@ use Knp\Rad\Mailer\Mail; use Knp\Rad\Mailer\MailFactory; use PhpSpec\ObjectBehavior; -use Prophecy\Argument; class ConfigurationAwareFactorySpec extends ObjectBehavior { @@ -15,7 +14,7 @@ function let(MailFactory $factory) 'the_mail' => [ 'from' => 'mail@mail.com', 'to' => 'to@mail.com', - ] + ], ]; $this->beConstructedWith($configuration, $factory); diff --git a/spec/Knp/UniMail/Mailer/EventDispatcherMailerSpec.php b/spec/Knp/UniMail/Mailer/EventDispatcherMailerSpec.php index 70ac418..9c24e5a 100644 --- a/spec/Knp/UniMail/Mailer/EventDispatcherMailerSpec.php +++ b/spec/Knp/UniMail/Mailer/EventDispatcherMailerSpec.php @@ -43,7 +43,7 @@ function it_dispatchs_events_when_a_mail_is_sent($wrapped, $dispatcher) $dispatcher ->dispatch( MailerEvents::PRE_SEND, - Argument::that(function($e) use ($mail) { + Argument::that(function ($e) use ($mail) { return $mail === $e->getMail(); }) ) @@ -53,7 +53,7 @@ function it_dispatchs_events_when_a_mail_is_sent($wrapped, $dispatcher) $dispatcher ->dispatch( MailerEvents::preSend($mail), - Argument::that(function($e) use ($mail) { + Argument::that(function ($e) use ($mail) { return $mail === $e->getMail(); }) ) @@ -63,7 +63,7 @@ function it_dispatchs_events_when_a_mail_is_sent($wrapped, $dispatcher) $dispatcher ->dispatch( MailerEvents::POST_SEND, - Argument::that(function($e) use ($mail) { + Argument::that(function ($e) use ($mail) { return $mail === $e->getMail(); }) ) @@ -73,7 +73,7 @@ function it_dispatchs_events_when_a_mail_is_sent($wrapped, $dispatcher) $dispatcher ->dispatch( MailerEvents::postSend($mail), - Argument::that(function($e) use ($mail) { + Argument::that(function ($e) use ($mail) { return $mail === $e->getMail(); }) ) diff --git a/src/Knp/UniMail/EventListener/AttachmentResolver.php b/src/Knp/UniMail/EventListener/AttachmentResolver.php index d47b5fb..44df0a0 100644 --- a/src/Knp/UniMail/EventListener/AttachmentResolver.php +++ b/src/Knp/UniMail/EventListener/AttachmentResolver.php @@ -18,7 +18,7 @@ public function __construct(AttachmentFactory $factory) public static function getSubscribedEvents() { return [ - MailerEvents::PRE_SEND => array('beforeSend', -2), + MailerEvents::PRE_SEND => ['beforeSend', -2], ]; } diff --git a/src/Knp/UniMail/EventListener/CidAttachmentMerger.php b/src/Knp/UniMail/EventListener/CidAttachmentMerger.php index 2c0af1a..9e91f36 100644 --- a/src/Knp/UniMail/EventListener/CidAttachmentMerger.php +++ b/src/Knp/UniMail/EventListener/CidAttachmentMerger.php @@ -19,7 +19,7 @@ public function __construct(Collection $cids) public static function getSubscribedEvents() { return [ - MailerEvents::PRE_SEND => array('beforeSend', -3), + MailerEvents::PRE_SEND => ['beforeSend', -3], ]; } diff --git a/src/Knp/UniMail/EventListener/TwigRenderer.php b/src/Knp/UniMail/EventListener/TwigRenderer.php index a2ed790..9de6d76 100644 --- a/src/Knp/UniMail/EventListener/TwigRenderer.php +++ b/src/Knp/UniMail/EventListener/TwigRenderer.php @@ -21,7 +21,7 @@ public function __construct(Twig_Environment $twig) public static function getSubscribedEvents() { return [ - MailerEvents::PRE_SEND => array('beforeSend', -2), + MailerEvents::PRE_SEND => ['beforeSend', -2], ]; } diff --git a/src/Knp/UniMail/Resources/config/services.yml b/src/Knp/UniMail/Resources/config/services.yml index 5e4e872..e592c3a 100644 --- a/src/Knp/UniMail/Resources/config/services.yml +++ b/src/Knp/UniMail/Resources/config/services.yml @@ -21,6 +21,16 @@ services: knp_unimail.cid.collection: class: Knp\UniMail\Cid\Collection + knp_unimail.cid.resolver.local_file: + class: Knp\UniMail\Cid\Resolver\LocalFile + arguments: + - %knp_unimail.attachments_directory% + + knp_unimail.cid.resolver.remove_file: + class: Knp\UniMail\Cid\Resolver\RemoteFile + arguments: + - %knp_unimail.attachments_directory% + knp_unimail.event_listener.attachment_resolver: class: Knp\UniMail\EventListener\AttachmentResolver arguments: @@ -87,13 +97,3 @@ services: - [@knp_unimail.cid.resolver.local_file, @knp_unimail.cid.resolver.remove_file] tags: - { name: twig.extension } - - knp_unimail.cid.resolver.local_file: - class: Knp\UniMail\Cid\Resolver\LocalFile - arguments: - - %knp_unimail.attachments_directory% - - knp_unimail.cid.resolver.remove_file: - class: Knp\UniMail\Cid\Resolver\RemoteFile - arguments: - - %knp_unimail.attachments_directory%