Skip to content

Commit

Permalink
Add static mailer name
Browse files Browse the repository at this point in the history
  • Loading branch information
jadb committed Apr 19, 2015
1 parent 66cae3e commit 9108e26
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Mailer/Mailer.php
Expand Up @@ -22,6 +22,13 @@ abstract class Mailer implements ArrayAccess, EventListenerInterface
{
use ModelAwareTrait;

/**
* Mailer's name.
*
* @var string
*/
static public $name;

/**
* Layout.
*
Expand Down Expand Up @@ -61,7 +68,14 @@ public function __construct(Email $email = null)
*/
public function getName()
{
return str_replace('Mailer', '', join('', array_slice(explode('\\', get_class($this)), -1)));
if (!static::$name) {
static::$name = str_replace(
'Mailer',
'',
join('', array_slice(explode('\\', get_class($this)), -1))
);
}
return static::$name;
}

/**
Expand Down

0 comments on commit 9108e26

Please sign in to comment.