@@ -22,24 +22,24 @@ |
||
| 22 | 22 | class PHPView extends AbstractView |
| 23 | 23 | { |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Render the current Renderable for a given context. |
|
| 27 | - * |
|
| 28 | - * @since 1.0.0 |
|
| 29 | - * |
|
| 30 | - * @param array $context The context in which to render the Renderable. |
|
| 31 | - * @param string|null $content Optional. The content that the view should |
|
| 32 | - * represent. |
|
| 33 | - * |
|
| 34 | - * @return string Rendered output of the Renderable. |
|
| 35 | - */ |
|
| 36 | - public function render(array $context, $content = null) |
|
| 37 | - { |
|
| 25 | + /** |
|
| 26 | + * Render the current Renderable for a given context. |
|
| 27 | + * |
|
| 28 | + * @since 1.0.0 |
|
| 29 | + * |
|
| 30 | + * @param array $context The context in which to render the Renderable. |
|
| 31 | + * @param string|null $content Optional. The content that the view should |
|
| 32 | + * represent. |
|
| 33 | + * |
|
| 34 | + * @return string Rendered output of the Renderable. |
|
| 35 | + */ |
|
| 36 | + public function render(array $context, $content = null) |
|
| 37 | + { |
|
| 38 | 38 | |
| 39 | - ob_start(); |
|
| 39 | + ob_start(); |
|
| 40 | 40 | |
| 41 | - include $this->viewLocation . '.php'; |
|
| 41 | + include $this->viewLocation . '.php'; |
|
| 42 | 42 | |
| 43 | - return ob_get_clean(); |
|
| 44 | - } |
|
| 43 | + return ob_get_clean(); |
|
| 44 | + } |
|
| 45 | 45 | } |
@@ -25,35 +25,35 @@ |
||
| 25 | 25 | abstract class AbstractView implements ViewInterface |
| 26 | 26 | { |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Configuration Settings. |
|
| 30 | - * |
|
| 31 | - * @since 1.0.0 |
|
| 32 | - * |
|
| 33 | - * @var ConfigInterface |
|
| 34 | - */ |
|
| 35 | - protected $config; |
|
| 28 | + /** |
|
| 29 | + * Configuration Settings. |
|
| 30 | + * |
|
| 31 | + * @since 1.0.0 |
|
| 32 | + * |
|
| 33 | + * @var ConfigInterface |
|
| 34 | + */ |
|
| 35 | + protected $config; |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Location of the view data. |
|
| 39 | - * |
|
| 40 | - * @since 1.0.0 |
|
| 41 | - * |
|
| 42 | - * @var 1.0.0 |
|
| 43 | - */ |
|
| 44 | - protected $viewLocation; |
|
| 37 | + /** |
|
| 38 | + * Location of the view data. |
|
| 39 | + * |
|
| 40 | + * @since 1.0.0 |
|
| 41 | + * |
|
| 42 | + * @var 1.0.0 |
|
| 43 | + */ |
|
| 44 | + protected $viewLocation; |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Instantiate a View object. |
|
| 48 | - * |
|
| 49 | - * @since 1.0.0 |
|
| 50 | - * |
|
| 51 | - * @param ConfigInterface $config Configuration settings. |
|
| 52 | - * @param string $viewLocation Location of the View to render. |
|
| 53 | - */ |
|
| 54 | - public function __construct($config, $viewLocation) |
|
| 55 | - { |
|
| 56 | - $this->config = $config; |
|
| 57 | - $this->viewLocation = $viewLocation; |
|
| 58 | - } |
|
| 46 | + /** |
|
| 47 | + * Instantiate a View object. |
|
| 48 | + * |
|
| 49 | + * @since 1.0.0 |
|
| 50 | + * |
|
| 51 | + * @param ConfigInterface $config Configuration settings. |
|
| 52 | + * @param string $viewLocation Location of the View to render. |
|
| 53 | + */ |
|
| 54 | + public function __construct($config, $viewLocation) |
|
| 55 | + { |
|
| 56 | + $this->config = $config; |
|
| 57 | + $this->viewLocation = $viewLocation; |
|
| 58 | + } |
|
| 59 | 59 | } |
@@ -22,27 +22,27 @@ |
||
| 22 | 22 | class HTMLMail extends AbstractMail |
| 23 | 23 | { |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Set the format of the mail. |
|
| 27 | - * |
|
| 28 | - * @since 1.0.0 |
|
| 29 | - */ |
|
| 30 | - protected function setFormat() |
|
| 31 | - { |
|
| 32 | - $this->format = 'html'; |
|
| 33 | - } |
|
| 25 | + /** |
|
| 26 | + * Set the format of the mail. |
|
| 27 | + * |
|
| 28 | + * @since 1.0.0 |
|
| 29 | + */ |
|
| 30 | + protected function setFormat() |
|
| 31 | + { |
|
| 32 | + $this->format = 'html'; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Set the context of the renderer. |
|
| 37 | - * |
|
| 38 | - * @since 1.0.0 |
|
| 39 | - * |
|
| 40 | - * @param array $context Context to set/modify. |
|
| 41 | - * |
|
| 42 | - * @return array Updated context. |
|
| 43 | - */ |
|
| 44 | - protected function setContext(array $context) |
|
| 45 | - { |
|
| 46 | - return $context; |
|
| 47 | - } |
|
| 35 | + /** |
|
| 36 | + * Set the context of the renderer. |
|
| 37 | + * |
|
| 38 | + * @since 1.0.0 |
|
| 39 | + * |
|
| 40 | + * @param array $context Context to set/modify. |
|
| 41 | + * |
|
| 42 | + * @return array Updated context. |
|
| 43 | + */ |
|
| 44 | + protected function setContext(array $context) |
|
| 45 | + { |
|
| 46 | + return $context; |
|
| 47 | + } |
|
| 48 | 48 | } |
@@ -28,205 +28,205 @@ |
||
| 28 | 28 | abstract class AbstractMail implements MailInterface |
| 29 | 29 | { |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Configuration Settings. |
|
| 33 | - * |
|
| 34 | - * @since 1.0.0 |
|
| 35 | - * |
|
| 36 | - * @var ConfigInterface |
|
| 37 | - */ |
|
| 38 | - protected $config; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * Template that is used for the email. |
|
| 42 | - * |
|
| 43 | - * @since 1.0.0 |
|
| 44 | - * |
|
| 45 | - * @var TemplateInterface |
|
| 46 | - */ |
|
| 47 | - protected $template; |
|
| 48 | - |
|
| 49 | - /** |
|
| 50 | - * Content for the different sections. |
|
| 51 | - * |
|
| 52 | - * @since 1.0.0 |
|
| 53 | - * |
|
| 54 | - * @var array |
|
| 55 | - */ |
|
| 56 | - protected $sectionContent = []; |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * Format of the mail. |
|
| 60 | - * |
|
| 61 | - * @since 1.0.0 |
|
| 62 | - * |
|
| 63 | - * @var string |
|
| 64 | - */ |
|
| 65 | - protected $format; |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * Instantiate an AbstractMail object. |
|
| 69 | - * |
|
| 70 | - * @since 1.0.0 |
|
| 71 | - * |
|
| 72 | - * @param ConfigInterface $config |
|
| 73 | - */ |
|
| 74 | - public function __construct(ConfigInterface $config) |
|
| 75 | - { |
|
| 76 | - $this->config = $config; |
|
| 77 | - $this->setFormat(); |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * Get the template to use for the renderer. |
|
| 82 | - * |
|
| 83 | - * @since 1.0.0 |
|
| 84 | - * |
|
| 85 | - * @return TemplateInterface Reference to the template that is used. |
|
| 86 | - * @throws RuntimeException |
|
| 87 | - */ |
|
| 88 | - public function getTemplate() |
|
| 89 | - { |
|
| 90 | - |
|
| 91 | - if (! $this->template) { |
|
| 92 | - $this->setDefaultTemplate(); |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - if (is_string($this->template)) { |
|
| 96 | - $this->template = $this->createTemplate($this->template); |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - return $this->template; |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * Set the template to use for the renderer. |
|
| 104 | - * |
|
| 105 | - * @since 1.0.0 |
|
| 106 | - * |
|
| 107 | - * @param string|TemplateInterface $template Template to use for the |
|
| 108 | - * renderer. |
|
| 109 | - * |
|
| 110 | - * @throws RuntimeException |
|
| 111 | - */ |
|
| 112 | - public function setTemplate($template) |
|
| 113 | - { |
|
| 114 | - if (is_string($template)) { |
|
| 115 | - $template = $this->createTemplate($template); |
|
| 116 | - } |
|
| 117 | - $this->template = $template; |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - /** |
|
| 121 | - * Add a section to the Mail. |
|
| 122 | - * |
|
| 123 | - * @since 1.0.0 |
|
| 124 | - * |
|
| 125 | - * @param string $type Type of section to add. |
|
| 126 | - * @param string $content Content of the section. |
|
| 127 | - * |
|
| 128 | - * @throws RuntimeException |
|
| 129 | - */ |
|
| 130 | - public function addSection($type, $content) |
|
| 131 | - { |
|
| 132 | - $this->sectionContent[$type] = $content; |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - /** |
|
| 136 | - * Render the Mail for a given context. |
|
| 137 | - * |
|
| 138 | - * @since 1.0.0 |
|
| 139 | - * |
|
| 140 | - * @param array $context The context in which to render the email. |
|
| 141 | - * |
|
| 142 | - * @return string Rendered output of the email |
|
| 143 | - * @throws RuntimeException |
|
| 144 | - */ |
|
| 145 | - public function render(array $context) |
|
| 146 | - { |
|
| 147 | - |
|
| 148 | - $template = $this->getTemplate(); |
|
| 149 | - |
|
| 150 | - $context['template'] = $template; |
|
| 151 | - |
|
| 152 | - $sections = $template->getUsedSections(); |
|
| 153 | - |
|
| 154 | - $sectionFactory = new Factory($this->config, 'sections'); |
|
| 155 | - foreach ($sections as $section) { |
|
| 156 | - $content = null; |
|
| 157 | - if (array_key_exists($section, $this->sectionContent)) { |
|
| 158 | - $content = $this->sectionContent[$section]; |
|
| 159 | - } |
|
| 160 | - $context['sections'][$section] = $sectionFactory->create($section, |
|
| 161 | - [$section, $content]); |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - $context['format'] = $this->getFormat(); |
|
| 165 | - |
|
| 166 | - $context = $this->setContext($context); |
|
| 167 | - |
|
| 168 | - return $template->render($context); |
|
| 169 | - } |
|
| 170 | - |
|
| 171 | - /** |
|
| 172 | - * Set the format of the mail. |
|
| 173 | - * |
|
| 174 | - * @since 1.0.0 |
|
| 175 | - * |
|
| 176 | - * @return string Format of the Mail. |
|
| 177 | - */ |
|
| 178 | - protected function getFormat() |
|
| 179 | - { |
|
| 180 | - return $this->format; |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - /** |
|
| 184 | - * Set the format of the mail. |
|
| 185 | - * |
|
| 186 | - * @since 1.0.0 |
|
| 187 | - * |
|
| 188 | - * @return void |
|
| 189 | - */ |
|
| 190 | - abstract protected function setFormat(); |
|
| 191 | - |
|
| 192 | - /** |
|
| 193 | - * Set the template to the default template defined in the configuration. |
|
| 194 | - * |
|
| 195 | - * @since 1.0.0 |
|
| 196 | - * |
|
| 197 | - * @throws RuntimeException |
|
| 198 | - */ |
|
| 199 | - protected function setDefaultTemplate() |
|
| 200 | - { |
|
| 201 | - $defaultTemplate = $this->config->getKey('default_template'); |
|
| 202 | - $this->setTemplate($defaultTemplate); |
|
| 203 | - } |
|
| 204 | - |
|
| 205 | - /** |
|
| 206 | - * Create an instance of a template. |
|
| 207 | - * |
|
| 208 | - * @since 1.0.0 |
|
| 209 | - * |
|
| 210 | - * @param string $template Template to instantiate. |
|
| 211 | - * |
|
| 212 | - * @return TemplateInterface $template Newly created instance. |
|
| 213 | - * @throws RuntimeException |
|
| 214 | - */ |
|
| 215 | - protected function createTemplate($template) |
|
| 216 | - { |
|
| 217 | - $templateFactory = new Factory($this->config, 'templates'); |
|
| 218 | - |
|
| 219 | - return $templateFactory->create($template, [$template]); |
|
| 220 | - } |
|
| 221 | - |
|
| 222 | - /** |
|
| 223 | - * Set the context of the mail. |
|
| 224 | - * |
|
| 225 | - * @since 1.0.0 |
|
| 226 | - * |
|
| 227 | - * @param array $context Context to set/modify. |
|
| 228 | - * |
|
| 229 | - * @return array Updated context. |
|
| 230 | - */ |
|
| 231 | - abstract protected function setContext(array $context); |
|
| 31 | + /** |
|
| 32 | + * Configuration Settings. |
|
| 33 | + * |
|
| 34 | + * @since 1.0.0 |
|
| 35 | + * |
|
| 36 | + * @var ConfigInterface |
|
| 37 | + */ |
|
| 38 | + protected $config; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * Template that is used for the email. |
|
| 42 | + * |
|
| 43 | + * @since 1.0.0 |
|
| 44 | + * |
|
| 45 | + * @var TemplateInterface |
|
| 46 | + */ |
|
| 47 | + protected $template; |
|
| 48 | + |
|
| 49 | + /** |
|
| 50 | + * Content for the different sections. |
|
| 51 | + * |
|
| 52 | + * @since 1.0.0 |
|
| 53 | + * |
|
| 54 | + * @var array |
|
| 55 | + */ |
|
| 56 | + protected $sectionContent = []; |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * Format of the mail. |
|
| 60 | + * |
|
| 61 | + * @since 1.0.0 |
|
| 62 | + * |
|
| 63 | + * @var string |
|
| 64 | + */ |
|
| 65 | + protected $format; |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * Instantiate an AbstractMail object. |
|
| 69 | + * |
|
| 70 | + * @since 1.0.0 |
|
| 71 | + * |
|
| 72 | + * @param ConfigInterface $config |
|
| 73 | + */ |
|
| 74 | + public function __construct(ConfigInterface $config) |
|
| 75 | + { |
|
| 76 | + $this->config = $config; |
|
| 77 | + $this->setFormat(); |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * Get the template to use for the renderer. |
|
| 82 | + * |
|
| 83 | + * @since 1.0.0 |
|
| 84 | + * |
|
| 85 | + * @return TemplateInterface Reference to the template that is used. |
|
| 86 | + * @throws RuntimeException |
|
| 87 | + */ |
|
| 88 | + public function getTemplate() |
|
| 89 | + { |
|
| 90 | + |
|
| 91 | + if (! $this->template) { |
|
| 92 | + $this->setDefaultTemplate(); |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + if (is_string($this->template)) { |
|
| 96 | + $this->template = $this->createTemplate($this->template); |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + return $this->template; |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * Set the template to use for the renderer. |
|
| 104 | + * |
|
| 105 | + * @since 1.0.0 |
|
| 106 | + * |
|
| 107 | + * @param string|TemplateInterface $template Template to use for the |
|
| 108 | + * renderer. |
|
| 109 | + * |
|
| 110 | + * @throws RuntimeException |
|
| 111 | + */ |
|
| 112 | + public function setTemplate($template) |
|
| 113 | + { |
|
| 114 | + if (is_string($template)) { |
|
| 115 | + $template = $this->createTemplate($template); |
|
| 116 | + } |
|
| 117 | + $this->template = $template; |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + /** |
|
| 121 | + * Add a section to the Mail. |
|
| 122 | + * |
|
| 123 | + * @since 1.0.0 |
|
| 124 | + * |
|
| 125 | + * @param string $type Type of section to add. |
|
| 126 | + * @param string $content Content of the section. |
|
| 127 | + * |
|
| 128 | + * @throws RuntimeException |
|
| 129 | + */ |
|
| 130 | + public function addSection($type, $content) |
|
| 131 | + { |
|
| 132 | + $this->sectionContent[$type] = $content; |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + /** |
|
| 136 | + * Render the Mail for a given context. |
|
| 137 | + * |
|
| 138 | + * @since 1.0.0 |
|
| 139 | + * |
|
| 140 | + * @param array $context The context in which to render the email. |
|
| 141 | + * |
|
| 142 | + * @return string Rendered output of the email |
|
| 143 | + * @throws RuntimeException |
|
| 144 | + */ |
|
| 145 | + public function render(array $context) |
|
| 146 | + { |
|
| 147 | + |
|
| 148 | + $template = $this->getTemplate(); |
|
| 149 | + |
|
| 150 | + $context['template'] = $template; |
|
| 151 | + |
|
| 152 | + $sections = $template->getUsedSections(); |
|
| 153 | + |
|
| 154 | + $sectionFactory = new Factory($this->config, 'sections'); |
|
| 155 | + foreach ($sections as $section) { |
|
| 156 | + $content = null; |
|
| 157 | + if (array_key_exists($section, $this->sectionContent)) { |
|
| 158 | + $content = $this->sectionContent[$section]; |
|
| 159 | + } |
|
| 160 | + $context['sections'][$section] = $sectionFactory->create($section, |
|
| 161 | + [$section, $content]); |
|
| 162 | + } |
|
| 163 | + |
|
| 164 | + $context['format'] = $this->getFormat(); |
|
| 165 | + |
|
| 166 | + $context = $this->setContext($context); |
|
| 167 | + |
|
| 168 | + return $template->render($context); |
|
| 169 | + } |
|
| 170 | + |
|
| 171 | + /** |
|
| 172 | + * Set the format of the mail. |
|
| 173 | + * |
|
| 174 | + * @since 1.0.0 |
|
| 175 | + * |
|
| 176 | + * @return string Format of the Mail. |
|
| 177 | + */ |
|
| 178 | + protected function getFormat() |
|
| 179 | + { |
|
| 180 | + return $this->format; |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + /** |
|
| 184 | + * Set the format of the mail. |
|
| 185 | + * |
|
| 186 | + * @since 1.0.0 |
|
| 187 | + * |
|
| 188 | + * @return void |
|
| 189 | + */ |
|
| 190 | + abstract protected function setFormat(); |
|
| 191 | + |
|
| 192 | + /** |
|
| 193 | + * Set the template to the default template defined in the configuration. |
|
| 194 | + * |
|
| 195 | + * @since 1.0.0 |
|
| 196 | + * |
|
| 197 | + * @throws RuntimeException |
|
| 198 | + */ |
|
| 199 | + protected function setDefaultTemplate() |
|
| 200 | + { |
|
| 201 | + $defaultTemplate = $this->config->getKey('default_template'); |
|
| 202 | + $this->setTemplate($defaultTemplate); |
|
| 203 | + } |
|
| 204 | + |
|
| 205 | + /** |
|
| 206 | + * Create an instance of a template. |
|
| 207 | + * |
|
| 208 | + * @since 1.0.0 |
|
| 209 | + * |
|
| 210 | + * @param string $template Template to instantiate. |
|
| 211 | + * |
|
| 212 | + * @return TemplateInterface $template Newly created instance. |
|
| 213 | + * @throws RuntimeException |
|
| 214 | + */ |
|
| 215 | + protected function createTemplate($template) |
|
| 216 | + { |
|
| 217 | + $templateFactory = new Factory($this->config, 'templates'); |
|
| 218 | + |
|
| 219 | + return $templateFactory->create($template, [$template]); |
|
| 220 | + } |
|
| 221 | + |
|
| 222 | + /** |
|
| 223 | + * Set the context of the mail. |
|
| 224 | + * |
|
| 225 | + * @since 1.0.0 |
|
| 226 | + * |
|
| 227 | + * @param array $context Context to set/modify. |
|
| 228 | + * |
|
| 229 | + * @return array Updated context. |
|
| 230 | + */ |
|
| 231 | + abstract protected function setContext(array $context); |
|
| 232 | 232 | } |
@@ -88,7 +88,7 @@ |
||
| 88 | 88 | public function getTemplate() |
| 89 | 89 | { |
| 90 | 90 | |
| 91 | - if (! $this->template) { |
|
| 91 | + if ( ! $this->template) { |
|
| 92 | 92 | $this->setDefaultTemplate(); |
| 93 | 93 | } |
| 94 | 94 | |
@@ -22,27 +22,27 @@ |
||
| 22 | 22 | class TextMail extends AbstractMail |
| 23 | 23 | { |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Set the format of the mail. |
|
| 27 | - * |
|
| 28 | - * @since 1.0.0 |
|
| 29 | - */ |
|
| 30 | - protected function setFormat() |
|
| 31 | - { |
|
| 32 | - $this->format = 'text'; |
|
| 33 | - } |
|
| 25 | + /** |
|
| 26 | + * Set the format of the mail. |
|
| 27 | + * |
|
| 28 | + * @since 1.0.0 |
|
| 29 | + */ |
|
| 30 | + protected function setFormat() |
|
| 31 | + { |
|
| 32 | + $this->format = 'text'; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Set the context of the renderer. |
|
| 37 | - * |
|
| 38 | - * @since 1.0.0 |
|
| 39 | - * |
|
| 40 | - * @param array $context Context to set/modify. |
|
| 41 | - * |
|
| 42 | - * @return array Updated context. |
|
| 43 | - */ |
|
| 44 | - protected function setContext(array $context) |
|
| 45 | - { |
|
| 46 | - return $context; |
|
| 47 | - } |
|
| 35 | + /** |
|
| 36 | + * Set the context of the renderer. |
|
| 37 | + * |
|
| 38 | + * @since 1.0.0 |
|
| 39 | + * |
|
| 40 | + * @param array $context Context to set/modify. |
|
| 41 | + * |
|
| 42 | + * @return array Updated context. |
|
| 43 | + */ |
|
| 44 | + protected function setContext(array $context) |
|
| 45 | + { |
|
| 46 | + return $context; |
|
| 47 | + } |
|
| 48 | 48 | } |
@@ -24,36 +24,36 @@ |
||
| 24 | 24 | interface MailInterface extends Renderable |
| 25 | 25 | { |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Set the template that the email will use. |
|
| 29 | - * |
|
| 30 | - * @since 1.0.0 |
|
| 31 | - * |
|
| 32 | - * @param string|TemplateInterface $template Template to use. |
|
| 33 | - * |
|
| 34 | - * @return void |
|
| 35 | - */ |
|
| 36 | - public function setTemplate($template); |
|
| 27 | + /** |
|
| 28 | + * Set the template that the email will use. |
|
| 29 | + * |
|
| 30 | + * @since 1.0.0 |
|
| 31 | + * |
|
| 32 | + * @param string|TemplateInterface $template Template to use. |
|
| 33 | + * |
|
| 34 | + * @return void |
|
| 35 | + */ |
|
| 36 | + public function setTemplate($template); |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Get the instance of the template. |
|
| 40 | - * |
|
| 41 | - * @since 1.0.0 |
|
| 42 | - * |
|
| 43 | - * @return TemplateInterface |
|
| 44 | - */ |
|
| 45 | - public function getTemplate(); |
|
| 38 | + /** |
|
| 39 | + * Get the instance of the template. |
|
| 40 | + * |
|
| 41 | + * @since 1.0.0 |
|
| 42 | + * |
|
| 43 | + * @return TemplateInterface |
|
| 44 | + */ |
|
| 45 | + public function getTemplate(); |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Add a section to the Mail. |
|
| 49 | - * |
|
| 50 | - * @since 1.0.0 |
|
| 51 | - * |
|
| 52 | - * @param string $type Type of section to add. |
|
| 53 | - * @param string $content Content of the section. |
|
| 54 | - * |
|
| 55 | - * @return void |
|
| 56 | - * @throws RuntimeException |
|
| 57 | - */ |
|
| 58 | - public function addSection($type, $content); |
|
| 47 | + /** |
|
| 48 | + * Add a section to the Mail. |
|
| 49 | + * |
|
| 50 | + * @since 1.0.0 |
|
| 51 | + * |
|
| 52 | + * @param string $type Type of section to add. |
|
| 53 | + * @param string $content Content of the section. |
|
| 54 | + * |
|
| 55 | + * @return void |
|
| 56 | + * @throws RuntimeException |
|
| 57 | + */ |
|
| 58 | + public function addSection($type, $content); |
|
| 59 | 59 | } |
@@ -22,15 +22,15 @@ |
||
| 22 | 22 | interface ValidatorInterface |
| 23 | 23 | { |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Validate the content for a given context. |
|
| 27 | - * |
|
| 28 | - * @since 1.0.0 |
|
| 29 | - * |
|
| 30 | - * @param string $content Content to validate. |
|
| 31 | - * @param array $context Context in which to validate. |
|
| 32 | - * |
|
| 33 | - * @return string Validated content. |
|
| 34 | - */ |
|
| 35 | - public function validate($content, array $context); |
|
| 25 | + /** |
|
| 26 | + * Validate the content for a given context. |
|
| 27 | + * |
|
| 28 | + * @since 1.0.0 |
|
| 29 | + * |
|
| 30 | + * @param string $content Content to validate. |
|
| 31 | + * @param array $context Context in which to validate. |
|
| 32 | + * |
|
| 33 | + * @return string Validated content. |
|
| 34 | + */ |
|
| 35 | + public function validate($content, array $context); |
|
| 36 | 36 | } |
@@ -22,18 +22,18 @@ |
||
| 22 | 22 | class TextSanitizer extends AbstractSanitizer |
| 23 | 23 | { |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Sanitize the content for a given context. |
|
| 27 | - * |
|
| 28 | - * @since 1.0.0 |
|
| 29 | - * |
|
| 30 | - * @param string $content Content to sanitize. |
|
| 31 | - * @param array $context Context in which to sanitize. |
|
| 32 | - * |
|
| 33 | - * @return string Sanitized content. |
|
| 34 | - */ |
|
| 35 | - public function sanitize($content, array $context) |
|
| 36 | - { |
|
| 37 | - return $content; |
|
| 38 | - } |
|
| 25 | + /** |
|
| 26 | + * Sanitize the content for a given context. |
|
| 27 | + * |
|
| 28 | + * @since 1.0.0 |
|
| 29 | + * |
|
| 30 | + * @param string $content Content to sanitize. |
|
| 31 | + * @param array $context Context in which to sanitize. |
|
| 32 | + * |
|
| 33 | + * @return string Sanitized content. |
|
| 34 | + */ |
|
| 35 | + public function sanitize($content, array $context) |
|
| 36 | + { |
|
| 37 | + return $content; |
|
| 38 | + } |
|
| 39 | 39 | } |
@@ -22,18 +22,18 @@ |
||
| 22 | 22 | class HTMLSanitizer extends AbstractSanitizer |
| 23 | 23 | { |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Sanitize the content for a given context. |
|
| 27 | - * |
|
| 28 | - * @since 1.0.0 |
|
| 29 | - * |
|
| 30 | - * @param string $content Content to sanitize. |
|
| 31 | - * @param array $context Context in which to sanitize. |
|
| 32 | - * |
|
| 33 | - * @return string Sanitized content. |
|
| 34 | - */ |
|
| 35 | - public function sanitize($content, array $context) |
|
| 36 | - { |
|
| 37 | - return $content; |
|
| 38 | - } |
|
| 25 | + /** |
|
| 26 | + * Sanitize the content for a given context. |
|
| 27 | + * |
|
| 28 | + * @since 1.0.0 |
|
| 29 | + * |
|
| 30 | + * @param string $content Content to sanitize. |
|
| 31 | + * @param array $context Context in which to sanitize. |
|
| 32 | + * |
|
| 33 | + * @return string Sanitized content. |
|
| 34 | + */ |
|
| 35 | + public function sanitize($content, array $context) |
|
| 36 | + { |
|
| 37 | + return $content; |
|
| 38 | + } |
|
| 39 | 39 | } |