Passed
Push — master ( a263b7...6f8328 )
by Alain
02:24
created
src/Mail/AbstractMail.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,6 @@
 block discarded – undo
16 16
 use BrightNucleus\ChainMail\MailInterface;
17 17
 use BrightNucleus\ChainMail\Support\ConfigInterface;
18 18
 use BrightNucleus\ChainMail\TemplateInterface;
19
-use BrightNucleus\ChainMail\SectionInterface;
20 19
 
21 20
 /**
22 21
  * Abstract Class AbstractMail
Please login to merge, or discard this patch.
Indentation   +202 added lines, -202 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * AbstractMail
4
- *
5
- * @package   brightnucleus/chainmail
6
- * @author    Alain Schlesser <[email protected]>
7
- * @license   GPL-2.0+
8
- * @link      http://www.brightnucleus.com/
9
- * @copyright 2016 Alain Schlesser, Bright Nucleus
10
- */
3
+	 * AbstractMail
4
+	 *
5
+	 * @package   brightnucleus/chainmail
6
+	 * @author    Alain Schlesser <[email protected]>
7
+	 * @license   GPL-2.0+
8
+	 * @link      http://www.brightnucleus.com/
9
+	 * @copyright 2016 Alain Schlesser, Bright Nucleus
10
+	 */
11 11
 
12 12
 namespace BrightNucleus\ChainMail\Mail;
13 13
 
@@ -29,198 +29,198 @@  discard block
 block discarded – undo
29 29
 abstract class AbstractMail implements MailInterface
30 30
 {
31 31
 
32
-    /**
33
-     * Configuration Settings.
34
-     *
35
-     * @since 1.0.0
36
-     *
37
-     * @var ConfigInterface
38
-     */
39
-    protected $config;
40
-
41
-    /**
42
-     * Template that is used for the email.
43
-     *
44
-     * @since 1.0.0
45
-     *
46
-     * @var TemplateInterface
47
-     */
48
-    protected $template;
49
-
50
-    /**
51
-     * Content for the different sections.
52
-     *
53
-     * @since 1.0.0
54
-     *
55
-     * @var array
56
-     */
57
-    protected $sectionContent = [];
58
-
59
-    /**
60
-     * Format of the mail.
61
-     *
62
-     * @since 1.0.0
63
-     *
64
-     * @var string
65
-     */
66
-    protected $format;
67
-
68
-    /**
69
-     * Instantiate an AbstractMail object.
70
-     *
71
-     * @since 1.0.0
72
-     *
73
-     * @param ConfigInterface $config
74
-     */
75
-    public function __construct(ConfigInterface $config)
76
-    {
77
-        $this->config = $config;
78
-        $this->setFormat();
79
-    }
80
-
81
-    /**
82
-     * Set the format of the mail.
83
-     *
84
-     * @since 1.0.0
85
-     *
86
-     * @return string Format of the Mail.
87
-     */
88
-    protected function getFormat()
89
-    {
90
-        return $this->format;
91
-    }
92
-
93
-    /**
94
-     * Set the format of the mail.
95
-     *
96
-     * @since 1.0.0
97
-     */
98
-    abstract protected function setFormat();
99
-
100
-    /**
101
-     * Set the template to use for the renderer.
102
-     *
103
-     * @since 1.0.0
104
-     *
105
-     * @param string|TemplateInterface $template Template to use for the
106
-     *                                           renderer.
107
-     * @throws RuntimeException
108
-     */
109
-    public function setTemplate($template)
110
-    {
111
-        if (is_string($template)) {
112
-            $template = $this->createTemplate($template);
113
-        }
114
-        $this->template = $template;
115
-    }
116
-
117
-    /**
118
-     * Get the template to use for the renderer.
119
-     *
120
-     * @since 1.0.0
121
-     *
122
-     * @return TemplateInterface Reference to the template that is used.
123
-     * @throws RuntimeException
124
-     */
125
-    public function getTemplate()
126
-    {
127
-
128
-        if ( ! $this->template) {
129
-            $this->setDefaultTemplate();
130
-        }
131
-
132
-        if (is_string($this->template)) {
133
-            $this->template = $this->createTemplate($this->template);
134
-        }
135
-
136
-        return $this->template;
137
-    }
138
-
139
-    /**
140
-     * Set the template to the default template defined in the configuration.
141
-     *
142
-     * @since 1.0.0
143
-     *
144
-     * @throws RuntimeException
145
-     */
146
-    protected function setDefaultTemplate()
147
-    {
148
-        $defaultTemplate = $this->config->getKey('default_template');
149
-        $this->setTemplate($defaultTemplate);
150
-    }
151
-
152
-    /**
153
-     * Create an instance of a template.
154
-     *
155
-     * @since 1.0.0
156
-     *
157
-     * @param string $template Template to instantiate.
158
-     * @return TemplateInterface $template Newly created instance.
159
-     * @throws RuntimeException
160
-     */
161
-    protected function createTemplate($template)
162
-    {
163
-        $templateFactory = new Factory($this->config, 'templates');
164
-
165
-        return $templateFactory->create($template, [$template]);
166
-    }
167
-
168
-    /**
169
-     * Add a section to the Mail.
170
-     *
171
-     * @since 1.0.0
172
-     *
173
-     * @param string $type    Type of section to add.
174
-     * @param string $content Content of the section.
175
-     * @throws RuntimeException
176
-     */
177
-    public function addSection($type, $content)
178
-    {
179
-        $this->sectionContent[$type] = $content;
180
-    }
181
-
182
-    /**
183
-     * Render the Mail for a given context.
184
-     *
185
-     * @since 1.0.0
186
-     *
187
-     * @param array $context The context in which to render the email.
188
-     * @return string Rendered output of the email
189
-     * @throws RuntimeException
190
-     */
191
-    public function render(array $context)
192
-    {
193
-
194
-        $template = $this->getTemplate();
195
-
196
-        $context['template'] = $template;
197
-
198
-        $sections = $template->getUsedSections();
199
-
200
-        $sectionFactory = new Factory($this->config, 'sections');
201
-        foreach ($sections as $section) {
202
-            $content = null;
203
-            if (array_key_exists($section, $this->sectionContent)) {
204
-                $content = $this->sectionContent[$section];
205
-            }
206
-            $context['sections'][$section] = $sectionFactory->create($section,
207
-                [$section, $content]);
208
-        }
209
-
210
-        $context['format'] = $this->getFormat();
211
-
212
-        $context = $this->setContext($context);
213
-
214
-        return $template->render($context);
215
-    }
216
-
217
-    /**
218
-     * Set the context of the mail.
219
-     *
220
-     * @since 1.0.0
221
-     *
222
-     * @param array $context Context to set/modify.
223
-     * @return array Updated context.
224
-     */
225
-    abstract protected function setContext(array $context);
32
+	/**
33
+	 * Configuration Settings.
34
+	 *
35
+	 * @since 1.0.0
36
+	 *
37
+	 * @var ConfigInterface
38
+	 */
39
+	protected $config;
40
+
41
+	/**
42
+	 * Template that is used for the email.
43
+	 *
44
+	 * @since 1.0.0
45
+	 *
46
+	 * @var TemplateInterface
47
+	 */
48
+	protected $template;
49
+
50
+	/**
51
+	 * Content for the different sections.
52
+	 *
53
+	 * @since 1.0.0
54
+	 *
55
+	 * @var array
56
+	 */
57
+	protected $sectionContent = [];
58
+
59
+	/**
60
+	 * Format of the mail.
61
+	 *
62
+	 * @since 1.0.0
63
+	 *
64
+	 * @var string
65
+	 */
66
+	protected $format;
67
+
68
+	/**
69
+	 * Instantiate an AbstractMail object.
70
+	 *
71
+	 * @since 1.0.0
72
+	 *
73
+	 * @param ConfigInterface $config
74
+	 */
75
+	public function __construct(ConfigInterface $config)
76
+	{
77
+		$this->config = $config;
78
+		$this->setFormat();
79
+	}
80
+
81
+	/**
82
+	 * Set the format of the mail.
83
+	 *
84
+	 * @since 1.0.0
85
+	 *
86
+	 * @return string Format of the Mail.
87
+	 */
88
+	protected function getFormat()
89
+	{
90
+		return $this->format;
91
+	}
92
+
93
+	/**
94
+	 * Set the format of the mail.
95
+	 *
96
+	 * @since 1.0.0
97
+	 */
98
+	abstract protected function setFormat();
99
+
100
+	/**
101
+	 * Set the template to use for the renderer.
102
+	 *
103
+	 * @since 1.0.0
104
+	 *
105
+	 * @param string|TemplateInterface $template Template to use for the
106
+	 *                                           renderer.
107
+	 * @throws RuntimeException
108
+	 */
109
+	public function setTemplate($template)
110
+	{
111
+		if (is_string($template)) {
112
+			$template = $this->createTemplate($template);
113
+		}
114
+		$this->template = $template;
115
+	}
116
+
117
+	/**
118
+	 * Get the template to use for the renderer.
119
+	 *
120
+	 * @since 1.0.0
121
+	 *
122
+	 * @return TemplateInterface Reference to the template that is used.
123
+	 * @throws RuntimeException
124
+	 */
125
+	public function getTemplate()
126
+	{
127
+
128
+		if ( ! $this->template) {
129
+			$this->setDefaultTemplate();
130
+		}
131
+
132
+		if (is_string($this->template)) {
133
+			$this->template = $this->createTemplate($this->template);
134
+		}
135
+
136
+		return $this->template;
137
+	}
138
+
139
+	/**
140
+	 * Set the template to the default template defined in the configuration.
141
+	 *
142
+	 * @since 1.0.0
143
+	 *
144
+	 * @throws RuntimeException
145
+	 */
146
+	protected function setDefaultTemplate()
147
+	{
148
+		$defaultTemplate = $this->config->getKey('default_template');
149
+		$this->setTemplate($defaultTemplate);
150
+	}
151
+
152
+	/**
153
+	 * Create an instance of a template.
154
+	 *
155
+	 * @since 1.0.0
156
+	 *
157
+	 * @param string $template Template to instantiate.
158
+	 * @return TemplateInterface $template Newly created instance.
159
+	 * @throws RuntimeException
160
+	 */
161
+	protected function createTemplate($template)
162
+	{
163
+		$templateFactory = new Factory($this->config, 'templates');
164
+
165
+		return $templateFactory->create($template, [$template]);
166
+	}
167
+
168
+	/**
169
+	 * Add a section to the Mail.
170
+	 *
171
+	 * @since 1.0.0
172
+	 *
173
+	 * @param string $type    Type of section to add.
174
+	 * @param string $content Content of the section.
175
+	 * @throws RuntimeException
176
+	 */
177
+	public function addSection($type, $content)
178
+	{
179
+		$this->sectionContent[$type] = $content;
180
+	}
181
+
182
+	/**
183
+	 * Render the Mail for a given context.
184
+	 *
185
+	 * @since 1.0.0
186
+	 *
187
+	 * @param array $context The context in which to render the email.
188
+	 * @return string Rendered output of the email
189
+	 * @throws RuntimeException
190
+	 */
191
+	public function render(array $context)
192
+	{
193
+
194
+		$template = $this->getTemplate();
195
+
196
+		$context['template'] = $template;
197
+
198
+		$sections = $template->getUsedSections();
199
+
200
+		$sectionFactory = new Factory($this->config, 'sections');
201
+		foreach ($sections as $section) {
202
+			$content = null;
203
+			if (array_key_exists($section, $this->sectionContent)) {
204
+				$content = $this->sectionContent[$section];
205
+			}
206
+			$context['sections'][$section] = $sectionFactory->create($section,
207
+				[$section, $content]);
208
+		}
209
+
210
+		$context['format'] = $this->getFormat();
211
+
212
+		$context = $this->setContext($context);
213
+
214
+		return $template->render($context);
215
+	}
216
+
217
+	/**
218
+	 * Set the context of the mail.
219
+	 *
220
+	 * @since 1.0.0
221
+	 *
222
+	 * @param array $context Context to set/modify.
223
+	 * @return array Updated context.
224
+	 */
225
+	abstract protected function setContext(array $context);
226 226
 }
227 227
\ No newline at end of file
Please login to merge, or discard this patch.
config/defaults.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
      * specific view to be rendered.
20 20
      */
21 21
     'view_root_locations' => [
22
-        'default' => __DIR__ . '/../views',
22
+        'default' => __DIR__.'/../views',
23 23
     ],
24 24
 
25 25
     /*
Please login to merge, or discard this patch.
Indentation   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -13,187 +13,187 @@
 block discarded – undo
13 13
  */
14 14
 
15 15
 return [
16
-    /*
16
+	/*
17 17
      * Root location that contains the view files to be rendered. These are
18 18
      * referenced by the individual sections & templates when choosing a
19 19
      * specific view to be rendered.
20 20
      */
21
-    'view_root_locations' => [
22
-        'default' => __DIR__ . '/../views',
23
-    ],
21
+	'view_root_locations' => [
22
+		'default' => __DIR__ . '/../views',
23
+	],
24 24
 
25
-    /*
25
+	/*
26 26
      * Type of view rendering system to use.
27 27
      */
28
-    'view_type'           => 'PHPView',
28
+	'view_type'           => 'PHPView',
29 29
 
30
-    /*
30
+	/*
31 31
      * The default template to when none is specified.
32 32
      */
33
-    'default_template'    => 'BasicTemplate',
33
+	'default_template'    => 'BasicTemplate',
34 34
 
35
-    /*
35
+	/*
36 36
      * The formats in which an email can be rendered.
37 37
      * Each format needs a `MailInterface` implementation, a
38 38
      * `ValidatorInterface` implementation, as well as a `SanitizerInterface`
39 39
      * implementation.
40 40
      */
41
-    'formats'             => [
41
+	'formats'             => [
42 42
 
43
-        /*
43
+		/*
44 44
          * The `html` format should be the default format when using responsive
45 45
          * emails.
46 46
          */
47
-        'html' => [
48
-            'mail'      => 'HTMLMail',
49
-            'validator' => 'HTMLValidator',
50
-            'sanitizer' => 'HTMLSanitizer',
51
-        ],
47
+		'html' => [
48
+			'mail'      => 'HTMLMail',
49
+			'validator' => 'HTMLValidator',
50
+			'sanitizer' => 'HTMLSanitizer',
51
+		],
52 52
 
53
-        /*
53
+		/*
54 54
          * The `text` format is meant to be used a as a fallback, and can also
55 55
          * be sent as backup content embedded within HTML emails.
56 56
          */
57
-        'text' => [
58
-            'mail'      => 'TextMail',
59
-            'validator' => 'TextValidator',
60
-            'sanitizer' => 'TextSanitizer',
61
-        ],
62
-    ],
57
+		'text' => [
58
+			'mail'      => 'TextMail',
59
+			'validator' => 'TextValidator',
60
+			'sanitizer' => 'TextSanitizer',
61
+		],
62
+	],
63 63
 
64
-    /*
64
+	/*
65 65
      * The `MailInterface` implementations that are provided.
66 66
      */
67
-    'mails'               => [
68
-        'HTMLMail' => [
69
-            'class_name' => '\BrightNucleus\ChainMail\Mail\HTMLMail',
70
-        ],
71
-        'TextMail' => [
72
-            'class_name' => '\BrightNucleus\ChainMail\Mail\TextMail',
73
-        ],
74
-    ],
67
+	'mails'               => [
68
+		'HTMLMail' => [
69
+			'class_name' => '\BrightNucleus\ChainMail\Mail\HTMLMail',
70
+		],
71
+		'TextMail' => [
72
+			'class_name' => '\BrightNucleus\ChainMail\Mail\TextMail',
73
+		],
74
+	],
75 75
 
76
-    /*
76
+	/*
77 77
      * The `ValidatorInterface` implementations that are provided.
78 78
      */
79
-    'validators'          => [
80
-        'HTMLValidator' => [
81
-            'class_name' => '\BrightNucleus\ChainMail\Validator\HTMLValidator',
82
-        ],
83
-        'TextValidator' => [
84
-            'class_name' => '\BrightNucleus\ChainMail\Validator\TextValidator',
85
-        ],
86
-    ],
79
+	'validators'          => [
80
+		'HTMLValidator' => [
81
+			'class_name' => '\BrightNucleus\ChainMail\Validator\HTMLValidator',
82
+		],
83
+		'TextValidator' => [
84
+			'class_name' => '\BrightNucleus\ChainMail\Validator\TextValidator',
85
+		],
86
+	],
87 87
 
88
-    /*
88
+	/*
89 89
      * The `SanitizerInterface` implementations that are provided.
90 90
      */
91
-    'sanitizers'          => [
92
-        'HTMLSanitizer' => [
93
-            'class_name' => '\BrightNucleus\ChainMail\Sanitizer\HTMLSanitizer',
94
-        ],
95
-        'TextSanitizer' => [
96
-            'class_name' => '\BrightNucleus\ChainMail\Sanitizer\TextSanitizer',
97
-        ],
98
-    ],
91
+	'sanitizers'          => [
92
+		'HTMLSanitizer' => [
93
+			'class_name' => '\BrightNucleus\ChainMail\Sanitizer\HTMLSanitizer',
94
+		],
95
+		'TextSanitizer' => [
96
+			'class_name' => '\BrightNucleus\ChainMail\Sanitizer\TextSanitizer',
97
+		],
98
+	],
99 99
 
100
-    /*
100
+	/*
101 101
      * The `ViewInterface` implementations that are provided.
102 102
      */
103
-    'view_types'          => [
104
-        'PHPView' => [
105
-            'class_name' => '\BrightNucleus\ChainMail\View\PHPView',
106
-        ],
107
-    ],
103
+	'view_types'          => [
104
+		'PHPView' => [
105
+			'class_name' => '\BrightNucleus\ChainMail\View\PHPView',
106
+		],
107
+	],
108 108
 
109
-    /*
109
+	/*
110 110
      * The `TemplateInterface` implementations that are provided.
111 111
      *
112 112
      * Each template also defines what sections it intends to use, and what
113 113
      * view it intends to use for rendering.
114 114
      */
115
-    'templates'           => [
116
-        'BasicTemplate'       => [
117
-            'class_name'    => '\BrightNucleus\ChainMail\Template\GenericTemplate',
118
-            'sections'      => [
119
-                'HeaderSection',
120
-                'BodySection',
121
-                'FooterSection',
122
-            ],
123
-            'view_name'     => 'GenericTemplate',
124
-            'view_location' => 'default',
125
-        ],
126
-        'HeroTemplate'        => [
127
-            'class_name'    => '\BrightNucleus\ChainMail\Template\GenericTemplate',
128
-            'sections'      => [
129
-                'HeaderSection',
130
-                'HeroSection',
131
-                'BodySection',
132
-                'FooterSection',
133
-            ],
134
-            'view_name'     => 'GenericTemplate',
135
-            'view_location' => 'default',
136
-        ],
137
-        'SidebarTemplate'     => [
138
-            'class_name'    => '\BrightNucleus\ChainMail\Template\GenericTemplate',
139
-            'sections'      => [
140
-                'HeaderSection',
141
-                'BodySection',
142
-                'SidebarSection',
143
-                'FooterSection',
144
-            ],
145
-            'view_name'     => 'GenericTemplate',
146
-            'view_location' => 'default',
147
-        ],
148
-        'HeroSidebarTemplate' => [
149
-            'class_name'    => '\BrightNucleus\ChainMail\Template\GenericTemplate',
150
-            'sections'      => [
151
-                'HeaderSection',
152
-                'HeroSection',
153
-                'BodySection',
154
-                'SidebarSection',
155
-                'FooterSection',
156
-            ],
157
-            'view_name'     => 'GenericTemplate',
158
-            'view_location' => 'default',
159
-        ],
160
-    ],
115
+	'templates'           => [
116
+		'BasicTemplate'       => [
117
+			'class_name'    => '\BrightNucleus\ChainMail\Template\GenericTemplate',
118
+			'sections'      => [
119
+				'HeaderSection',
120
+				'BodySection',
121
+				'FooterSection',
122
+			],
123
+			'view_name'     => 'GenericTemplate',
124
+			'view_location' => 'default',
125
+		],
126
+		'HeroTemplate'        => [
127
+			'class_name'    => '\BrightNucleus\ChainMail\Template\GenericTemplate',
128
+			'sections'      => [
129
+				'HeaderSection',
130
+				'HeroSection',
131
+				'BodySection',
132
+				'FooterSection',
133
+			],
134
+			'view_name'     => 'GenericTemplate',
135
+			'view_location' => 'default',
136
+		],
137
+		'SidebarTemplate'     => [
138
+			'class_name'    => '\BrightNucleus\ChainMail\Template\GenericTemplate',
139
+			'sections'      => [
140
+				'HeaderSection',
141
+				'BodySection',
142
+				'SidebarSection',
143
+				'FooterSection',
144
+			],
145
+			'view_name'     => 'GenericTemplate',
146
+			'view_location' => 'default',
147
+		],
148
+		'HeroSidebarTemplate' => [
149
+			'class_name'    => '\BrightNucleus\ChainMail\Template\GenericTemplate',
150
+			'sections'      => [
151
+				'HeaderSection',
152
+				'HeroSection',
153
+				'BodySection',
154
+				'SidebarSection',
155
+				'FooterSection',
156
+			],
157
+			'view_name'     => 'GenericTemplate',
158
+			'view_location' => 'default',
159
+		],
160
+	],
161 161
 
162
-    /*
162
+	/*
163 163
      * The `SectionInterface` implementations that are provided.
164 164
      *
165 165
      * Each section also defines what view it intends to use for rendering.
166 166
      */
167
-    'sections'            => [
168
-        'HeaderSection'  => [
169
-            'css_class'     => 'header',
170
-            'class_name'    => '\BrightNucleus\ChainMail\Section\GenericSection',
171
-            'view_name'     => 'GenericSection',
172
-            'view_location' => 'default',
173
-        ],
174
-        'BodySection'    => [
175
-            'css_class'     => 'body',
176
-            'class_name'    => '\BrightNucleus\ChainMail\Section\GenericSection',
177
-            'view_name'     => 'GenericSection',
178
-            'view_location' => 'default',
179
-        ],
180
-        'FooterSection'  => [
181
-            'css_class'     => 'footer',
182
-            'class_name'    => '\BrightNucleus\ChainMail\Section\GenericSection',
183
-            'view_name'     => 'GenericSection',
184
-            'view_location' => 'default',
185
-        ],
186
-        'HeroSection'    => [
187
-            'css_class'     => 'hero',
188
-            'class_name'    => '\BrightNucleus\ChainMail\Section\GenericSection',
189
-            'view_name'     => 'GenericSection',
190
-            'view_location' => 'default',
191
-        ],
192
-        'SidebarSection' => [
193
-            'css_class'     => 'sidebar',
194
-            'class_name'    => '\BrightNucleus\ChainMail\Section\GenericSection',
195
-            'view_name'     => 'GenericSection',
196
-            'view_location' => 'default',
197
-        ],
198
-    ],
167
+	'sections'            => [
168
+		'HeaderSection'  => [
169
+			'css_class'     => 'header',
170
+			'class_name'    => '\BrightNucleus\ChainMail\Section\GenericSection',
171
+			'view_name'     => 'GenericSection',
172
+			'view_location' => 'default',
173
+		],
174
+		'BodySection'    => [
175
+			'css_class'     => 'body',
176
+			'class_name'    => '\BrightNucleus\ChainMail\Section\GenericSection',
177
+			'view_name'     => 'GenericSection',
178
+			'view_location' => 'default',
179
+		],
180
+		'FooterSection'  => [
181
+			'css_class'     => 'footer',
182
+			'class_name'    => '\BrightNucleus\ChainMail\Section\GenericSection',
183
+			'view_name'     => 'GenericSection',
184
+			'view_location' => 'default',
185
+		],
186
+		'HeroSection'    => [
187
+			'css_class'     => 'hero',
188
+			'class_name'    => '\BrightNucleus\ChainMail\Section\GenericSection',
189
+			'view_name'     => 'GenericSection',
190
+			'view_location' => 'default',
191
+		],
192
+		'SidebarSection' => [
193
+			'css_class'     => 'sidebar',
194
+			'class_name'    => '\BrightNucleus\ChainMail\Section\GenericSection',
195
+			'view_name'     => 'GenericSection',
196
+			'view_location' => 'default',
197
+		],
198
+	],
199 199
 ];
200 200
\ No newline at end of file
Please login to merge, or discard this patch.
src/Section/AbstractSection.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@
 block discarded – undo
150 150
      */
151 151
     protected function getViewLocation(array $context)
152 152
     {
153
-        return $this->getViewRoot() . '/sections/' . $context['format'] . '/' . $this->getViewName();
153
+        return $this->getViewRoot().'/sections/'.$context['format'].'/'.$this->getViewName();
154 154
     }
155 155
 
156 156
     /**
Please login to merge, or discard this patch.
Indentation   +160 added lines, -160 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * AbstractSection
4
- *
5
- * @package   brightnucleus/chainmail
6
- * @author    Alain Schlesser <[email protected]>
7
- * @license   GPL-2.0+
8
- * @link      http://www.brightnucleus.com/
9
- * @copyright 2016 Alain Schlesser, Bright Nucleus
10
- */
3
+	 * AbstractSection
4
+	 *
5
+	 * @package   brightnucleus/chainmail
6
+	 * @author    Alain Schlesser <[email protected]>
7
+	 * @license   GPL-2.0+
8
+	 * @link      http://www.brightnucleus.com/
9
+	 * @copyright 2016 Alain Schlesser, Bright Nucleus
10
+	 */
11 11
 
12 12
 namespace BrightNucleus\ChainMail\Section;
13 13
 
@@ -27,156 +27,156 @@  discard block
 block discarded – undo
27 27
 abstract class AbstractSection implements SectionInterface
28 28
 {
29 29
 
30
-    /**
31
-     * Name of the Section.
32
-     *
33
-     * @since 1.0.0
34
-     *
35
-     * @var string
36
-     */
37
-    protected $sectionName;
38
-
39
-    /**
40
-     * Configuration Settings.
41
-     *
42
-     * @since 1.0.0
43
-     *
44
-     * @var ConfigInterface
45
-     */
46
-    protected $config;
47
-
48
-    /**
49
-     * Content of the section.
50
-     *
51
-     * @since 1.0.0
52
-     *
53
-     * @var string
54
-     */
55
-    protected $content;
56
-
57
-    /**
58
-     * Instantiate a AbstractSection object.
59
-     *
60
-     * @since 1.0.0
61
-     *
62
-     * @param ConfigInterface $config       Configuration settings.
63
-     * @param array           $arguments    Arguments that are passed through
64
-     *                                      the constructor. Contained
65
-     *                                      elements: string $section, string
66
-     *                                      $content
67
-     * @throws RuntimeException
68
-     */
69
-    public function __construct($config, $arguments)
70
-    {
71
-        $this->config = $config;
72
-        list($section, $content) = $arguments;
73
-        $this->setSectionName($section);
74
-        $this->content = $content;
75
-    }
76
-
77
-    /**
78
-     * Set the name of the Section.
79
-     *
80
-     * @since 1.0.0
81
-     *
82
-     * @param string $section Optional. Name of the section.
83
-     * @throws RuntimeException
84
-     */
85
-    protected function setSectionName($section = null)
86
-    {
87
-        if (null === $section) {
88
-            throw new RuntimeException('Initialised section without passing it a section name.');
89
-        }
90
-        if ( ! array_key_exists($section, $this->config['sections'])) {
91
-            throw new RuntimeException('Initialised section with an unknown section name.');
92
-        }
93
-        $this->sectionName = $section;
94
-    }
95
-
96
-    /**
97
-     * Get the name of the Section.
98
-     *
99
-     * @since 1.0.0
100
-     *
101
-     * @return string Name of the section.
102
-     */
103
-    public function getSectionName()
104
-    {
105
-        return $this->sectionName;
106
-    }
107
-
108
-    /**
109
-     * Get the name of the View to use for rendering.
110
-     *
111
-     * @since 1.0.0
112
-     *
113
-     * @return string Name of the view.
114
-     */
115
-    protected function getViewName()
116
-    {
117
-        return $this->config['sections'][$this->getSectionName()]['view_name'];
118
-    }
119
-
120
-    /**
121
-     * Render the current Renderable for a given context.
122
-     *
123
-     * @since 1.0.0
124
-     *
125
-     * @param array $context The context in which to render the Renderable.
126
-     * @return string Rendered output of the Renderable.
127
-     * @throws RuntimeException
128
-     */
129
-    public function render(array $context)
130
-    {
131
-
132
-        $viewLocation = $this->getViewLocation($context);
133
-        $viewType     = $this->config['view_type'];
134
-
135
-        $viewFactory = new Factory($this->config, 'view_types');
136
-        $view        = $viewFactory->create($viewType, $viewLocation);
137
-
138
-        $context['css_class'] = $this->getCSSClass();
139
-
140
-        return $view->render($context, $this->content);
141
-    }
142
-
143
-    /**
144
-     * Get the location of the view that is used for rendering.
145
-     *
146
-     * @since 1.0.0
147
-     *
148
-     * @param array $context Context for which to get the view location.
149
-     * @return string
150
-     */
151
-    protected function getViewLocation(array $context)
152
-    {
153
-        return $this->getViewRoot() . '/sections/' . $context['format'] . '/' . $this->getViewName();
154
-    }
155
-
156
-    /**
157
-     * Get the root location of the view that is used for rendering.
158
-     *
159
-     * @since 1.0.0
160
-     *
161
-     * @return string
162
-     */
163
-    protected function getViewRoot()
164
-    {
165
-        $viewRoots   = $this->config['view_root_locations'];
166
-        $viewRootKey = $this->config['sections'][$this->getSectionName()]['view_location'];
167
-
168
-        return $viewRoots[$viewRootKey];
169
-    }
170
-
171
-    /**
172
-     * Get the CSS class that is used for the section.
173
-     *
174
-     * @since 1.0.0
175
-     *
176
-     * @return string
177
-     */
178
-    protected function getCSSClass()
179
-    {
180
-        return $this->config['sections'][$this->getSectionName()]['css_class'];
181
-    }
30
+	/**
31
+	 * Name of the Section.
32
+	 *
33
+	 * @since 1.0.0
34
+	 *
35
+	 * @var string
36
+	 */
37
+	protected $sectionName;
38
+
39
+	/**
40
+	 * Configuration Settings.
41
+	 *
42
+	 * @since 1.0.0
43
+	 *
44
+	 * @var ConfigInterface
45
+	 */
46
+	protected $config;
47
+
48
+	/**
49
+	 * Content of the section.
50
+	 *
51
+	 * @since 1.0.0
52
+	 *
53
+	 * @var string
54
+	 */
55
+	protected $content;
56
+
57
+	/**
58
+	 * Instantiate a AbstractSection object.
59
+	 *
60
+	 * @since 1.0.0
61
+	 *
62
+	 * @param ConfigInterface $config       Configuration settings.
63
+	 * @param array           $arguments    Arguments that are passed through
64
+	 *                                      the constructor. Contained
65
+	 *                                      elements: string $section, string
66
+	 *                                      $content
67
+	 * @throws RuntimeException
68
+	 */
69
+	public function __construct($config, $arguments)
70
+	{
71
+		$this->config = $config;
72
+		list($section, $content) = $arguments;
73
+		$this->setSectionName($section);
74
+		$this->content = $content;
75
+	}
76
+
77
+	/**
78
+	 * Set the name of the Section.
79
+	 *
80
+	 * @since 1.0.0
81
+	 *
82
+	 * @param string $section Optional. Name of the section.
83
+	 * @throws RuntimeException
84
+	 */
85
+	protected function setSectionName($section = null)
86
+	{
87
+		if (null === $section) {
88
+			throw new RuntimeException('Initialised section without passing it a section name.');
89
+		}
90
+		if ( ! array_key_exists($section, $this->config['sections'])) {
91
+			throw new RuntimeException('Initialised section with an unknown section name.');
92
+		}
93
+		$this->sectionName = $section;
94
+	}
95
+
96
+	/**
97
+	 * Get the name of the Section.
98
+	 *
99
+	 * @since 1.0.0
100
+	 *
101
+	 * @return string Name of the section.
102
+	 */
103
+	public function getSectionName()
104
+	{
105
+		return $this->sectionName;
106
+	}
107
+
108
+	/**
109
+	 * Get the name of the View to use for rendering.
110
+	 *
111
+	 * @since 1.0.0
112
+	 *
113
+	 * @return string Name of the view.
114
+	 */
115
+	protected function getViewName()
116
+	{
117
+		return $this->config['sections'][$this->getSectionName()]['view_name'];
118
+	}
119
+
120
+	/**
121
+	 * Render the current Renderable for a given context.
122
+	 *
123
+	 * @since 1.0.0
124
+	 *
125
+	 * @param array $context The context in which to render the Renderable.
126
+	 * @return string Rendered output of the Renderable.
127
+	 * @throws RuntimeException
128
+	 */
129
+	public function render(array $context)
130
+	{
131
+
132
+		$viewLocation = $this->getViewLocation($context);
133
+		$viewType     = $this->config['view_type'];
134
+
135
+		$viewFactory = new Factory($this->config, 'view_types');
136
+		$view        = $viewFactory->create($viewType, $viewLocation);
137
+
138
+		$context['css_class'] = $this->getCSSClass();
139
+
140
+		return $view->render($context, $this->content);
141
+	}
142
+
143
+	/**
144
+	 * Get the location of the view that is used for rendering.
145
+	 *
146
+	 * @since 1.0.0
147
+	 *
148
+	 * @param array $context Context for which to get the view location.
149
+	 * @return string
150
+	 */
151
+	protected function getViewLocation(array $context)
152
+	{
153
+		return $this->getViewRoot() . '/sections/' . $context['format'] . '/' . $this->getViewName();
154
+	}
155
+
156
+	/**
157
+	 * Get the root location of the view that is used for rendering.
158
+	 *
159
+	 * @since 1.0.0
160
+	 *
161
+	 * @return string
162
+	 */
163
+	protected function getViewRoot()
164
+	{
165
+		$viewRoots   = $this->config['view_root_locations'];
166
+		$viewRootKey = $this->config['sections'][$this->getSectionName()]['view_location'];
167
+
168
+		return $viewRoots[$viewRootKey];
169
+	}
170
+
171
+	/**
172
+	 * Get the CSS class that is used for the section.
173
+	 *
174
+	 * @since 1.0.0
175
+	 *
176
+	 * @return string
177
+	 */
178
+	protected function getCSSClass()
179
+	{
180
+		return $this->config['sections'][$this->getSectionName()]['css_class'];
181
+	}
182 182
 }
Please login to merge, or discard this patch.
src/Template/AbstractTemplate.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@
 block discarded – undo
155 155
      */
156 156
     protected function getViewLocation(array $context)
157 157
     {
158
-        return $this->getViewRoot() . '/templates/' . $context['format'] . '/' . $this->getViewName();
158
+        return $this->getViewRoot().'/templates/'.$context['format'].'/'.$this->getViewName();
159 159
     }
160 160
 
161 161
     /**
Please login to merge, or discard this patch.
Indentation   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * AbstractTemplate
4
- *
5
- * @package   brightnucleus/chainmail
6
- * @author    Alain Schlesser <[email protected]>
7
- * @license   GPL-2.0+
8
- * @link      http://www.brightnucleus.com/
9
- * @copyright 2016 Alain Schlesser, Bright Nucleus
10
- */
3
+	 * AbstractTemplate
4
+	 *
5
+	 * @package   brightnucleus/chainmail
6
+	 * @author    Alain Schlesser <[email protected]>
7
+	 * @license   GPL-2.0+
8
+	 * @link      http://www.brightnucleus.com/
9
+	 * @copyright 2016 Alain Schlesser, Bright Nucleus
10
+	 */
11 11
 
12 12
 namespace BrightNucleus\ChainMail\Template;
13 13
 
@@ -27,149 +27,149 @@  discard block
 block discarded – undo
27 27
 abstract class AbstractTemplate implements TemplateInterface
28 28
 {
29 29
 
30
-    /**
31
-     * Configuration Settings.
32
-     *
33
-     * @since 1.0.0
34
-     *
35
-     * @var ConfigInterface
36
-     */
37
-    protected $config;
38
-
39
-    /**
40
-     * Name of the template.
41
-     *
42
-     * @since 1.0.0
43
-     *
44
-     * @var string
45
-     */
46
-    protected $templateName;
47
-
48
-    /**
49
-     * Instantiate a AbstractTemplate object.
50
-     *
51
-     * @since 1.0.0
52
-     *
53
-     * @param ConfigInterface $config       Configuration settings.
54
-     * @param array           $arguments    Arguments that are passed through
55
-     *                                      the constructor. Contained
56
-     *                                      elements: string $template
57
-     * @throws RuntimeException
58
-     */
59
-    public function __construct($config, $arguments)
60
-    {
61
-        $this->config = $config;
62
-        list($template) = $arguments;
63
-        $this->setTemplateName($template);
64
-    }
65
-
66
-    /**
67
-     * Get the name of the Template.
68
-     *
69
-     * @since 1.0.0
70
-     *
71
-     * @return string Name of the template.
72
-     */
73
-    public function getTemplateName()
74
-    {
75
-        return $this->templateName;
76
-    }
77
-
78
-    /**
79
-     * Set the name of the Template.
80
-     *
81
-     * @since 1.0.0
82
-     *
83
-     * @param string $template Optional. Name of the template.
84
-     * @throws RuntimeException
85
-     */
86
-    protected function setTemplateName($template = null)
87
-    {
88
-        if (null === $template) {
89
-            throw new RuntimeException('Initialised template without passing it a template name.');
90
-        }
91
-        if ( ! array_key_exists($template, $this->config['templates'])) {
92
-            throw new RuntimeException('Initialised template with an unknown template name.');
93
-        }
94
-        $this->templateName = $template;
95
-    }
96
-
97
-    /**
98
-     * Get the name of the View to use for rendering.
99
-     *
100
-     * @since 1.0.0
101
-     *
102
-     * @return string Name of the view.
103
-     */
104
-    protected function getViewName()
105
-    {
106
-        return $this->config['templates'][$this->getTemplateName()]['view_name'];
107
-    }
108
-
109
-    /**
110
-     * Get an array of Sections that are used by this template.
111
-     *
112
-     * @since 1.0.0
113
-     *
114
-     * @return array Sections that are used by this template.
115
-     */
116
-    public function getUsedSections()
117
-    {
118
-        return $this->config['templates'][$this->getTemplateName()]['sections'];
119
-    }
120
-
121
-    /**
122
-     * Render the template for a given context.
123
-     *
124
-     * @since 1.0.0
125
-     *
126
-     * @param array $context The context in which to render the template.
127
-     * @return string The rendered content.
128
-     * @throws RuntimeException
129
-     */
130
-    public function render(array $context)
131
-    {
132
-
133
-        $viewLocation = $this->getViewLocation($context);
134
-        $viewType     = $this->config['view_type'];
135
-
136
-        $viewFactory = new Factory($this->config, 'view_types');
137
-        $view        = $viewFactory->create($viewType, $viewLocation);
138
-
139
-        $sanitizerType    = $this->config['formats'][$context['format']]['sanitizer'];
140
-        $sanitizerFactory = new Factory($this->config, 'sanitizers');
141
-        $sanitizer        = $sanitizerFactory->create($sanitizerType);
142
-
143
-        $output = $view->render($context);
144
-
145
-        return $sanitizer->sanitize($output, $context);
146
-    }
147
-
148
-    /**
149
-     * Get the location of the view that is used for rendering.
150
-     *
151
-     * @since 1.0.0
152
-     *
153
-     * @param array $context Context for which to get the view location.
154
-     * @return string
155
-     */
156
-    protected function getViewLocation(array $context)
157
-    {
158
-        return $this->getViewRoot() . '/templates/' . $context['format'] . '/' . $this->getViewName();
159
-    }
160
-
161
-    /**
162
-     * Get the root location of the view that is used for rendering.
163
-     *
164
-     * @since 1.0.0
165
-     *
166
-     * @return string
167
-     */
168
-    protected function getViewRoot()
169
-    {
170
-        $viewRoots   = $this->config['view_root_locations'];
171
-        $viewRootKey = $this->config['templates'][$this->getTemplateName()]['view_location'];
172
-
173
-        return $viewRoots[$viewRootKey];
174
-    }
30
+	/**
31
+	 * Configuration Settings.
32
+	 *
33
+	 * @since 1.0.0
34
+	 *
35
+	 * @var ConfigInterface
36
+	 */
37
+	protected $config;
38
+
39
+	/**
40
+	 * Name of the template.
41
+	 *
42
+	 * @since 1.0.0
43
+	 *
44
+	 * @var string
45
+	 */
46
+	protected $templateName;
47
+
48
+	/**
49
+	 * Instantiate a AbstractTemplate object.
50
+	 *
51
+	 * @since 1.0.0
52
+	 *
53
+	 * @param ConfigInterface $config       Configuration settings.
54
+	 * @param array           $arguments    Arguments that are passed through
55
+	 *                                      the constructor. Contained
56
+	 *                                      elements: string $template
57
+	 * @throws RuntimeException
58
+	 */
59
+	public function __construct($config, $arguments)
60
+	{
61
+		$this->config = $config;
62
+		list($template) = $arguments;
63
+		$this->setTemplateName($template);
64
+	}
65
+
66
+	/**
67
+	 * Get the name of the Template.
68
+	 *
69
+	 * @since 1.0.0
70
+	 *
71
+	 * @return string Name of the template.
72
+	 */
73
+	public function getTemplateName()
74
+	{
75
+		return $this->templateName;
76
+	}
77
+
78
+	/**
79
+	 * Set the name of the Template.
80
+	 *
81
+	 * @since 1.0.0
82
+	 *
83
+	 * @param string $template Optional. Name of the template.
84
+	 * @throws RuntimeException
85
+	 */
86
+	protected function setTemplateName($template = null)
87
+	{
88
+		if (null === $template) {
89
+			throw new RuntimeException('Initialised template without passing it a template name.');
90
+		}
91
+		if ( ! array_key_exists($template, $this->config['templates'])) {
92
+			throw new RuntimeException('Initialised template with an unknown template name.');
93
+		}
94
+		$this->templateName = $template;
95
+	}
96
+
97
+	/**
98
+	 * Get the name of the View to use for rendering.
99
+	 *
100
+	 * @since 1.0.0
101
+	 *
102
+	 * @return string Name of the view.
103
+	 */
104
+	protected function getViewName()
105
+	{
106
+		return $this->config['templates'][$this->getTemplateName()]['view_name'];
107
+	}
108
+
109
+	/**
110
+	 * Get an array of Sections that are used by this template.
111
+	 *
112
+	 * @since 1.0.0
113
+	 *
114
+	 * @return array Sections that are used by this template.
115
+	 */
116
+	public function getUsedSections()
117
+	{
118
+		return $this->config['templates'][$this->getTemplateName()]['sections'];
119
+	}
120
+
121
+	/**
122
+	 * Render the template for a given context.
123
+	 *
124
+	 * @since 1.0.0
125
+	 *
126
+	 * @param array $context The context in which to render the template.
127
+	 * @return string The rendered content.
128
+	 * @throws RuntimeException
129
+	 */
130
+	public function render(array $context)
131
+	{
132
+
133
+		$viewLocation = $this->getViewLocation($context);
134
+		$viewType     = $this->config['view_type'];
135
+
136
+		$viewFactory = new Factory($this->config, 'view_types');
137
+		$view        = $viewFactory->create($viewType, $viewLocation);
138
+
139
+		$sanitizerType    = $this->config['formats'][$context['format']]['sanitizer'];
140
+		$sanitizerFactory = new Factory($this->config, 'sanitizers');
141
+		$sanitizer        = $sanitizerFactory->create($sanitizerType);
142
+
143
+		$output = $view->render($context);
144
+
145
+		return $sanitizer->sanitize($output, $context);
146
+	}
147
+
148
+	/**
149
+	 * Get the location of the view that is used for rendering.
150
+	 *
151
+	 * @since 1.0.0
152
+	 *
153
+	 * @param array $context Context for which to get the view location.
154
+	 * @return string
155
+	 */
156
+	protected function getViewLocation(array $context)
157
+	{
158
+		return $this->getViewRoot() . '/templates/' . $context['format'] . '/' . $this->getViewName();
159
+	}
160
+
161
+	/**
162
+	 * Get the root location of the view that is used for rendering.
163
+	 *
164
+	 * @since 1.0.0
165
+	 *
166
+	 * @return string
167
+	 */
168
+	protected function getViewRoot()
169
+	{
170
+		$viewRoots   = $this->config['view_root_locations'];
171
+		$viewRootKey = $this->config['templates'][$this->getTemplateName()]['view_location'];
172
+
173
+		return $viewRoots[$viewRootKey];
174
+	}
175 175
 }
Please login to merge, or discard this patch.
src/View/PHPView.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 
38 38
         ob_start();
39 39
 
40
-        include $this->viewLocation . '.php';
40
+        include $this->viewLocation.'.php';
41 41
 
42 42
         return ob_get_clean();
43 43
     }
Please login to merge, or discard this patch.
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * PHPView
4
- *
5
- * @package   brightnucleus/chainmail
6
- * @author    Alain Schlesser <[email protected]>
7
- * @license   GPL-2.0+
8
- * @link      http://www.brightnucleus.com/
9
- * @copyright 2016 Alain Schlesser, Bright Nucleus
10
- */
3
+	 * PHPView
4
+	 *
5
+	 * @package   brightnucleus/chainmail
6
+	 * @author    Alain Schlesser <[email protected]>
7
+	 * @license   GPL-2.0+
8
+	 * @link      http://www.brightnucleus.com/
9
+	 * @copyright 2016 Alain Schlesser, Bright Nucleus
10
+	 */
11 11
 
12 12
 namespace BrightNucleus\ChainMail\View;
13 13
 
@@ -22,23 +22,23 @@  discard block
 block discarded – undo
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 $content Optional. The content that the view should
32
-     *                        represent.
33
-     * @return string Rendered output of the Renderable.
34
-     */
35
-    public function render(array $context, $content = null)
36
-    {
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 $content Optional. The content that the view should
32
+	 *                        represent.
33
+	 * @return string Rendered output of the Renderable.
34
+	 */
35
+	public function render(array $context, $content = null)
36
+	{
37 37
 
38
-        ob_start();
38
+		ob_start();
39 39
 
40
-        include $this->viewLocation . '.php';
40
+		include $this->viewLocation . '.php';
41 41
 
42
-        return ob_get_clean();
43
-    }
42
+		return ob_get_clean();
43
+	}
44 44
 }
45 45
\ No newline at end of file
Please login to merge, or discard this patch.
src/MailInterface.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -30,6 +30,7 @@  discard block
 block discarded – undo
30 30
      * @since 1.0.0
31 31
      *
32 32
      * @param string|TemplateInterface $template Template to use.
33
+     * @return void
33 34
      */
34 35
     public function setTemplate($template);
35 36
 
@@ -50,6 +51,7 @@  discard block
 block discarded – undo
50 51
      * @param string $type    Type of section to add.
51 52
      * @param string $content Content of the section.
52 53
      * @throws RuntimeException
54
+     * @return void
53 55
      */
54 56
     public function addSection($type, $content);
55 57
 }
56 58
\ No newline at end of file
Please login to merge, or discard this patch.
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * MailInterface
4
- *
5
- * @package   brightnucleus/chainmail
6
- * @author    Alain Schlesser <[email protected]>
7
- * @license   GPL-2.0+
8
- * @link      http://www.brightnucleus.com/
9
- * @copyright 2016 Alain Schlesser, Bright Nucleus
10
- */
3
+	 * MailInterface
4
+	 *
5
+	 * @package   brightnucleus/chainmail
6
+	 * @author    Alain Schlesser <[email protected]>
7
+	 * @license   GPL-2.0+
8
+	 * @link      http://www.brightnucleus.com/
9
+	 * @copyright 2016 Alain Schlesser, Bright Nucleus
10
+	 */
11 11
 
12 12
 namespace BrightNucleus\ChainMail;
13 13
 
@@ -24,32 +24,32 @@  discard block
 block discarded – undo
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
-    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
+	public function setTemplate($template);
35 35
 
36
-    /**
37
-     * Get the instance of the template.
38
-     *
39
-     * @since 1.0.0
40
-     *
41
-     * @return TemplateInterface
42
-     */
43
-    public function getTemplate();
36
+	/**
37
+	 * Get the instance of the template.
38
+	 *
39
+	 * @since 1.0.0
40
+	 *
41
+	 * @return TemplateInterface
42
+	 */
43
+	public function getTemplate();
44 44
 
45
-    /**
46
-     * Add a section to the Mail.
47
-     *
48
-     * @since 1.0.0
49
-     *
50
-     * @param string $type    Type of section to add.
51
-     * @param string $content Content of the section.
52
-     * @throws RuntimeException
53
-     */
54
-    public function addSection($type, $content);
45
+	/**
46
+	 * Add a section to the Mail.
47
+	 *
48
+	 * @since 1.0.0
49
+	 *
50
+	 * @param string $type    Type of section to add.
51
+	 * @param string $content Content of the section.
52
+	 * @throws RuntimeException
53
+	 */
54
+	public function addSection($type, $content);
55 55
 }
56 56
\ No newline at end of file
Please login to merge, or discard this patch.
src/ChainMail.php 2 patches
Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * ChainMail
4
- *
5
- * @package   brightnucleus/chainmail
6
- * @author    Alain Schlesser <[email protected]>
7
- * @license   GPL-2.0+
8
- * @link      http://www.brightnucleus.com/
9
- * @copyright 2016 Alain Schlesser, Bright Nucleus
10
- */
3
+	 * ChainMail
4
+	 *
5
+	 * @package   brightnucleus/chainmail
6
+	 * @author    Alain Schlesser <[email protected]>
7
+	 * @license   GPL-2.0+
8
+	 * @link      http://www.brightnucleus.com/
9
+	 * @copyright 2016 Alain Schlesser, Bright Nucleus
10
+	 */
11 11
 
12 12
 namespace BrightNucleus\ChainMail;
13 13
 
@@ -27,112 +27,112 @@  discard block
 block discarded – undo
27 27
 class ChainMail
28 28
 {
29 29
 
30
-    const DEFAULT_CONFIG = __DIR__ . '/../config/defaults.php';
31
-
32
-    /**
33
-     * Configuration Settings.
34
-     *
35
-     * @since 1.0.0
36
-     *
37
-     * @var ConfigInterface
38
-     */
39
-    protected $config;
40
-
41
-    /**
42
-     * Instantiate a ChainMail object.
43
-     *
44
-     * @since 1.0.0
45
-     *
46
-     * @param ConfigInterface|null $config Optional. Configuration settings.
47
-     */
48
-    public function __construct(ConfigInterface $config = null)
49
-    {
50
-
51
-        $defaults = new Config(include(ChainMail::DEFAULT_CONFIG));
52
-
53
-        if ( ! $config) {
54
-            $this->config = $defaults;
55
-
56
-            return;
57
-        }
58
-
59
-        $this->config = new Config(array_merge(
60
-                (array)$defaults,
61
-                (array)$config)
62
-        );
63
-    }
64
-
65
-    /**
66
-     * Create a new mail object.
67
-     *
68
-     * @since 1.0.0
69
-     *
70
-     * @param string|null                   $format   Optional. Format to use.
71
-     * @param string|TemplateInterface|null $template Optional. Template to be
72
-     *                                                used.
73
-     * @return MailInterface
74
-     * @throws RuntimeException
75
-     */
76
-    public function createMail($format = null, $template = null)
77
-    {
78
-        $mail_factory = new Factory($this->config, 'mails');
79
-        $mail_class   = $this->config->getKey('formats')[$format]['mail'];
80
-        $mail         = $mail_factory->create($mail_class);
81
-        $mail->setTemplate($template);
82
-
83
-        return $mail;
84
-    }
85
-
86
-    /**
87
-     * Render a specific section.
88
-     *
89
-     * @since 1.0.0
90
-     *
91
-     * @param string $sectionType Type of section to render.
92
-     * @param array  $context     The context in which to render the section.
93
-     * @return string Rendered HTML.
94
-     */
95
-    public static function renderSection($sectionType, $context)
96
-    {
97
-        /** @var SectionInterface $section */
98
-        $section = $context['sections'][$sectionType];
99
-
100
-        return $section->render($context);
101
-    }
102
-
103
-    /**
104
-     * Get an array of strings representing the sections that are used by the
105
-     * template.
106
-     *
107
-     * @since 1.0.0
108
-     *
109
-     * @param array $context The context in which to render the section.
110
-     * @return array Array of strings with section types.
111
-     */
112
-    public static function getUsedSections($context)
113
-    {
114
-        /** @var TemplateInterface $template */
115
-        $template = $context['template'];
116
-
117
-        return $template->getUsedSections();
118
-    }
119
-
120
-    /**
121
-     * Render a all used sections.
122
-     *
123
-     * @since 1.0.0
124
-     *
125
-     * @param array $context The context in which to render the section.
126
-     * @return string Rendered HTML.
127
-     */
128
-    public static function renderSections($context)
129
-    {
130
-        $output = '';
131
-
132
-        foreach (ChainMail::getUsedSections($context) as $section) {
133
-            $output .= ChainMail::renderSection($section, $context);
134
-        }
135
-
136
-        return $output;
137
-    }
30
+	const DEFAULT_CONFIG = __DIR__ . '/../config/defaults.php';
31
+
32
+	/**
33
+	 * Configuration Settings.
34
+	 *
35
+	 * @since 1.0.0
36
+	 *
37
+	 * @var ConfigInterface
38
+	 */
39
+	protected $config;
40
+
41
+	/**
42
+	 * Instantiate a ChainMail object.
43
+	 *
44
+	 * @since 1.0.0
45
+	 *
46
+	 * @param ConfigInterface|null $config Optional. Configuration settings.
47
+	 */
48
+	public function __construct(ConfigInterface $config = null)
49
+	{
50
+
51
+		$defaults = new Config(include(ChainMail::DEFAULT_CONFIG));
52
+
53
+		if ( ! $config) {
54
+			$this->config = $defaults;
55
+
56
+			return;
57
+		}
58
+
59
+		$this->config = new Config(array_merge(
60
+				(array)$defaults,
61
+				(array)$config)
62
+		);
63
+	}
64
+
65
+	/**
66
+	 * Create a new mail object.
67
+	 *
68
+	 * @since 1.0.0
69
+	 *
70
+	 * @param string|null                   $format   Optional. Format to use.
71
+	 * @param string|TemplateInterface|null $template Optional. Template to be
72
+	 *                                                used.
73
+	 * @return MailInterface
74
+	 * @throws RuntimeException
75
+	 */
76
+	public function createMail($format = null, $template = null)
77
+	{
78
+		$mail_factory = new Factory($this->config, 'mails');
79
+		$mail_class   = $this->config->getKey('formats')[$format]['mail'];
80
+		$mail         = $mail_factory->create($mail_class);
81
+		$mail->setTemplate($template);
82
+
83
+		return $mail;
84
+	}
85
+
86
+	/**
87
+	 * Render a specific section.
88
+	 *
89
+	 * @since 1.0.0
90
+	 *
91
+	 * @param string $sectionType Type of section to render.
92
+	 * @param array  $context     The context in which to render the section.
93
+	 * @return string Rendered HTML.
94
+	 */
95
+	public static function renderSection($sectionType, $context)
96
+	{
97
+		/** @var SectionInterface $section */
98
+		$section = $context['sections'][$sectionType];
99
+
100
+		return $section->render($context);
101
+	}
102
+
103
+	/**
104
+	 * Get an array of strings representing the sections that are used by the
105
+	 * template.
106
+	 *
107
+	 * @since 1.0.0
108
+	 *
109
+	 * @param array $context The context in which to render the section.
110
+	 * @return array Array of strings with section types.
111
+	 */
112
+	public static function getUsedSections($context)
113
+	{
114
+		/** @var TemplateInterface $template */
115
+		$template = $context['template'];
116
+
117
+		return $template->getUsedSections();
118
+	}
119
+
120
+	/**
121
+	 * Render a all used sections.
122
+	 *
123
+	 * @since 1.0.0
124
+	 *
125
+	 * @param array $context The context in which to render the section.
126
+	 * @return string Rendered HTML.
127
+	 */
128
+	public static function renderSections($context)
129
+	{
130
+		$output = '';
131
+
132
+		foreach (ChainMail::getUsedSections($context) as $section) {
133
+			$output .= ChainMail::renderSection($section, $context);
134
+		}
135
+
136
+		return $output;
137
+	}
138 138
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 class ChainMail
28 28
 {
29 29
 
30
-    const DEFAULT_CONFIG = __DIR__ . '/../config/defaults.php';
30
+    const DEFAULT_CONFIG = __DIR__.'/../config/defaults.php';
31 31
 
32 32
     /**
33 33
      * Configuration Settings.
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
         }
58 58
 
59 59
         $this->config = new Config(array_merge(
60
-                (array)$defaults,
61
-                (array)$config)
60
+                (array) $defaults,
61
+                (array) $config)
62 62
         );
63 63
     }
64 64
 
Please login to merge, or discard this patch.
src/Mail/HTMLMail.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * HTMLMail
4
- *
5
- * @package   brightnucleus/chainmail
6
- * @author    Alain Schlesser <[email protected]>
7
- * @license   GPL-2.0+
8
- * @link      http://www.brightnucleus.com/
9
- * @copyright 2016 Alain Schlesser, Bright Nucleus
10
- */
3
+	 * HTMLMail
4
+	 *
5
+	 * @package   brightnucleus/chainmail
6
+	 * @author    Alain Schlesser <[email protected]>
7
+	 * @license   GPL-2.0+
8
+	 * @link      http://www.brightnucleus.com/
9
+	 * @copyright 2016 Alain Schlesser, Bright Nucleus
10
+	 */
11 11
 
12 12
 namespace BrightNucleus\ChainMail\Mail;
13 13
 
@@ -22,26 +22,26 @@  discard block
 block discarded – undo
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
-     * @return array Updated context.
42
-     */
43
-    protected function setContext(array $context)
44
-    {
45
-        return $context;
46
-    }
35
+	/**
36
+	 * Set the context of the renderer.
37
+	 *
38
+	 * @since 1.0.0
39
+	 *
40
+	 * @param array $context Context to set/modify.
41
+	 * @return array Updated context.
42
+	 */
43
+	protected function setContext(array $context)
44
+	{
45
+		return $context;
46
+	}
47 47
 }
48 48
\ No newline at end of file
Please login to merge, or discard this patch.
src/Mail/TextMail.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * TextMail
4
- *
5
- * @package   brightnucleus/chainmail
6
- * @author    Alain Schlesser <[email protected]>
7
- * @license   GPL-2.0+
8
- * @link      http://www.brightnucleus.com/
9
- * @copyright 2016 Alain Schlesser, Bright Nucleus
10
- */
3
+	 * TextMail
4
+	 *
5
+	 * @package   brightnucleus/chainmail
6
+	 * @author    Alain Schlesser <[email protected]>
7
+	 * @license   GPL-2.0+
8
+	 * @link      http://www.brightnucleus.com/
9
+	 * @copyright 2016 Alain Schlesser, Bright Nucleus
10
+	 */
11 11
 
12 12
 namespace BrightNucleus\ChainMail\Mail;
13 13
 
@@ -22,26 +22,26 @@  discard block
 block discarded – undo
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
-     * @return array Updated context.
42
-     */
43
-    protected function setContext(array $context)
44
-    {
45
-        return $context;
46
-    }
35
+	/**
36
+	 * Set the context of the renderer.
37
+	 *
38
+	 * @since 1.0.0
39
+	 *
40
+	 * @param array $context Context to set/modify.
41
+	 * @return array Updated context.
42
+	 */
43
+	protected function setContext(array $context)
44
+	{
45
+		return $context;
46
+	}
47 47
 }
48 48
\ No newline at end of file
Please login to merge, or discard this patch.