Skip to content
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

[WIP] Add documentation into the project #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
30 changes: 17 additions & 13 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
<?php

$finder = Symfony\CS\Finder\DefaultFinder::create()
->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')
)
;
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
}
],
"require": {
"php": ">=5.4",
"doctrine/collections": "~1.0",
"swiftmailer/swiftmailer": "~5.0",
"symfony/config": "~2.4",
Expand All @@ -19,6 +20,7 @@
},
"require-dev": {
"knplabs/phpspec-welldone-extension": "~1.0",
"pedrotroller/php-cs-custom-fixer": "^1.5",
"phpspec/phpspec": "^2.3"
},
"autoload": {
Expand All @@ -27,7 +29,8 @@
}
},
"config": {
"bin-dir": "bin"
"bin-dir": "bin",
"sort-packages": true
},
"extra": {
"branch-alias": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace spec\Knp\Rad\Mailer\AttachmentFactory;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class LocalAttachmentFactorySpec extends ObjectBehavior
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace spec\Knp\Rad\Mailer\AttachmentFactory;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class RemoteAttachmentFactorySpec extends ObjectBehavior
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Knp\Rad\Mailer\Mail;
use Knp\Rad\Mailer\MailFactory;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class ConfigurationAwareFactorySpec extends ObjectBehavior
{
Expand All @@ -15,7 +14,7 @@ function let(MailFactory $factory)
'the_mail' => [
'from' => 'mail@mail.com',
'to' => 'to@mail.com',
]
],
];

$this->beConstructedWith($configuration, $factory);
Expand Down
8 changes: 4 additions & 4 deletions spec/Knp/UniMail/Mailer/EventDispatcherMailerSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
})
)
Expand All @@ -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();
})
)
Expand All @@ -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();
})
)
Expand All @@ -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();
})
)
Expand Down
2 changes: 1 addition & 1 deletion src/Knp/UniMail/EventListener/AttachmentResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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],
];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Knp/UniMail/EventListener/CidAttachmentMerger.php
Original file line number Diff line number Diff line change
Expand Up @@ -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],
];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Knp/UniMail/EventListener/TwigRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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],
];
}

Expand Down
20 changes: 10 additions & 10 deletions src/Knp/UniMail/Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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%