-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 58cefb4
Showing
7 changed files
with
438 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
### Composer template | ||
composer.phar | ||
vendor/ | ||
|
||
### JetBrains template | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio | ||
|
||
*.iml | ||
|
||
## Directory-based project format: | ||
.idea/ | ||
# if you remove the above rule, at least ignore the following: | ||
|
||
# User-specific stuff: | ||
# .idea/workspace.xml | ||
# .idea/tasks.xml | ||
# .idea/dictionaries | ||
|
||
# Sensitive or high-churn files: | ||
# .idea/dataSources.ids | ||
# .idea/dataSources.xml | ||
# .idea/sqlDataSources.xml | ||
# .idea/dynamic.xml | ||
# .idea/uiDesigner.xml | ||
|
||
# Gradle: | ||
# .idea/gradle.xml | ||
# .idea/libraries | ||
|
||
# Mongo Explorer plugin: | ||
# .idea/mongoSettings.xml | ||
|
||
## File-based project format: | ||
*.ipr | ||
*.iws | ||
|
||
# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file | ||
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file | ||
# composer.lock | ||
|
||
|
||
## Plugin-specific files: | ||
|
||
# IntelliJ | ||
/out/ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
### Linux template | ||
*~ | ||
|
||
# KDE directory preferences | ||
.directory | ||
|
||
# Linux trash folder which might appear on any partition or disk | ||
.Trash-* | ||
### Windows template | ||
# Windows image file caches | ||
Thumbs.db | ||
ehthumbs.db | ||
|
||
# Folder config file | ||
Desktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msm | ||
*.msp | ||
|
||
# Windows shortcuts | ||
*.lnk | ||
### OSX template | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
# Created by .ignore support plugin (hsz.mobi) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
|
||
namespace Mailer\Contract; | ||
|
||
|
||
interface Formatable | ||
{ | ||
public function setFormatter(MessageFormatter $formatter); | ||
public function getFormatted(Messageable $message); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
|
||
namespace Mailer\Contract; | ||
|
||
|
||
interface MessageFormatter | ||
{ | ||
/** | ||
* @param Messageable $message | ||
* @return void | ||
*/ | ||
public function setMessage(Messageable $message); | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function format(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
|
||
namespace Mailer\Contract; | ||
|
||
interface Messageable | ||
{ | ||
/** | ||
* @return int | ||
*/ | ||
public function getClientId(); | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getEmail(); | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getFirstName(); | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getLastName(); | ||
|
||
public function setLang($lang = 'en'); | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getLang(); | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getEvent(); | ||
|
||
|
||
public function setExtras(array $extras); | ||
public function getExtras(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
|
||
namespace Mailer\Formatters; | ||
|
||
use Mailer\Contract\Messageable; | ||
use Mailer\Contract\MessageFormatter; | ||
|
||
class Events implements MessageFormatter | ||
{ | ||
/** | ||
* @var Messageable | ||
*/ | ||
private $message = null; | ||
private $source = ''; | ||
|
||
/** | ||
* @param Messageable $message | ||
*/ | ||
public function setMessage(Messageable $message) | ||
{ | ||
$this->message = $message; | ||
} | ||
|
||
public function setSource($name) | ||
{ | ||
$this->source = $name; | ||
} | ||
public function getSource() | ||
{ | ||
return !empty($this->source) ? $this->source : gethostname(); | ||
} | ||
|
||
|
||
/** | ||
* @return string | ||
*/ | ||
public function format() | ||
{ | ||
$out = array( | ||
'brand' => $this->getSource(), | ||
'event_name' => $this->message->getEvent(), | ||
'to' => array( | ||
'client_id' => $this->message->getClientId(), | ||
'email' => $this->message->getEmail(), | ||
'first_name' => $this->message->getFirstName(), | ||
'last_name' => $this->message->getLastName(), | ||
'lang' => $this->message->getLang(), | ||
), | ||
'vars' => $this->message->getExtras(), | ||
); | ||
return json_encode($out); | ||
} | ||
|
||
} |
Oops, something went wrong.