Passed
Push — master ( be0c82...f539f4 )
by Alain
02:33
created
src/Validator.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -22,15 +22,15 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Section/AbstractSection.php 1 patch
Indentation   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -28,145 +28,145 @@
 block discarded – undo
28 28
 abstract class AbstractSection implements Section
29 29
 {
30 30
 
31
-    /**
32
-     * Name of the Section.
33
-     *
34
-     * @since 1.0.0
35
-     *
36
-     * @var string
37
-     */
38
-    protected $sectionName;
39
-
40
-    /**
41
-     * Configuration Settings.
42
-     *
43
-     * @since 1.0.0
44
-     *
45
-     * @var ConfigInterface
46
-     */
47
-    protected $config;
48
-
49
-    /**
50
-     * Content of the section.
51
-     *
52
-     * @since 1.0.0
53
-     *
54
-     * @var string
55
-     */
56
-    protected $content;
57
-
58
-    /**
59
-     * ViewBuilder to create template and section views.
60
-     *
61
-     * @since 1.0.0
62
-     *
63
-     * @var ViewBuilder
64
-     */
65
-    protected $viewBuilder;
66
-
67
-    /**
68
-     * Instantiate a AbstractSection object.
69
-     *
70
-     * @since 1.0.0
71
-     *
72
-     * @param ConfigInterface $config    Configuration settings.
73
-     * @param array           $arguments Arguments that are passed through the constructor.
74
-     *                                   Contained elements:
75
-     *                                   string $section, string $content
76
-     *
77
-     * @throws RuntimeException
78
-     */
79
-    public function __construct($config, array $arguments)
80
-    {
81
-        $this->config = $config;
82
-        list($section, $content, $this->viewBuilder) = $arguments;
83
-        $this->setSectionName($section);
84
-        $this->content = $content;
85
-    }
86
-
87
-    /**
88
-     * Get the name of the Section.
89
-     *
90
-     * @since 1.0.0
91
-     *
92
-     * @return string Name of the section.
93
-     */
94
-    public function getSectionName()
95
-    {
96
-        return $this->sectionName;
97
-    }
98
-
99
-    /**
100
-     * Set the name of the Section.
101
-     *
102
-     * @since 1.0.0
103
-     *
104
-     * @param string|null $section Optional. Name of the section.
105
-     *
106
-     * @throws FailedToInitialiseSection If no section name was passed.
107
-     * @throws FailedToInitialiseSection If an unknown section name was passed.
108
-     */
109
-    protected function setSectionName($section = null)
110
-    {
111
-        if (null === $section) {
112
-            throw new FailedToInitialiseSection(
113
-                'Initialised section without passing it a section name.'
114
-            );
115
-        }
116
-        if ( ! array_key_exists($section, $this->config['sections'])) {
117
-            throw new FailedToInitialiseSection(
118
-                'Initialised section with an unknown section name.'
119
-            );
120
-        }
121
-        $this->sectionName = $section;
122
-    }
123
-
124
-    /**
125
-     * Render the current Renderable for a given context.
126
-     *
127
-     * @since 1.0.0
128
-     *
129
-     * @param array $context The context in which to render the Renderable.
130
-     *
131
-     * @return string Rendered output of the Renderable.
132
-     * @throws RuntimeException
133
-     */
134
-    public function render(array $context)
135
-    {
136
-
137
-        $viewName = $this->getViewName($context);
138
-        $view     = $this->viewBuilder->create($viewName);
139
-
140
-        $context['css_class'] = $this->getCSSClass();
141
-        $context['content']   = $this->content;
142
-
143
-        return $view->render($context);
144
-    }
145
-
146
-    /**
147
-     * Get the name of the View to use for rendering.
148
-     *
149
-     * @since 1.0.0
150
-     *
151
-     * @param array $context The context in which to render the template.
152
-     *
153
-     * @return string Name of the view.
154
-     */
155
-    protected function getViewName(array $context)
156
-    {
157
-        return $this->config['sections'][$this->getSectionName()]['view_name']
158
-               . '.' . $context['format'];
159
-    }
160
-
161
-    /**
162
-     * Get the CSS class that is used for the section.
163
-     *
164
-     * @since 1.0.0
165
-     *
166
-     * @return string
167
-     */
168
-    protected function getCSSClass()
169
-    {
170
-        return $this->config['sections'][$this->getSectionName()]['css_class'];
171
-    }
31
+	/**
32
+	 * Name of the Section.
33
+	 *
34
+	 * @since 1.0.0
35
+	 *
36
+	 * @var string
37
+	 */
38
+	protected $sectionName;
39
+
40
+	/**
41
+	 * Configuration Settings.
42
+	 *
43
+	 * @since 1.0.0
44
+	 *
45
+	 * @var ConfigInterface
46
+	 */
47
+	protected $config;
48
+
49
+	/**
50
+	 * Content of the section.
51
+	 *
52
+	 * @since 1.0.0
53
+	 *
54
+	 * @var string
55
+	 */
56
+	protected $content;
57
+
58
+	/**
59
+	 * ViewBuilder to create template and section views.
60
+	 *
61
+	 * @since 1.0.0
62
+	 *
63
+	 * @var ViewBuilder
64
+	 */
65
+	protected $viewBuilder;
66
+
67
+	/**
68
+	 * Instantiate a AbstractSection object.
69
+	 *
70
+	 * @since 1.0.0
71
+	 *
72
+	 * @param ConfigInterface $config    Configuration settings.
73
+	 * @param array           $arguments Arguments that are passed through the constructor.
74
+	 *                                   Contained elements:
75
+	 *                                   string $section, string $content
76
+	 *
77
+	 * @throws RuntimeException
78
+	 */
79
+	public function __construct($config, array $arguments)
80
+	{
81
+		$this->config = $config;
82
+		list($section, $content, $this->viewBuilder) = $arguments;
83
+		$this->setSectionName($section);
84
+		$this->content = $content;
85
+	}
86
+
87
+	/**
88
+	 * Get the name of the Section.
89
+	 *
90
+	 * @since 1.0.0
91
+	 *
92
+	 * @return string Name of the section.
93
+	 */
94
+	public function getSectionName()
95
+	{
96
+		return $this->sectionName;
97
+	}
98
+
99
+	/**
100
+	 * Set the name of the Section.
101
+	 *
102
+	 * @since 1.0.0
103
+	 *
104
+	 * @param string|null $section Optional. Name of the section.
105
+	 *
106
+	 * @throws FailedToInitialiseSection If no section name was passed.
107
+	 * @throws FailedToInitialiseSection If an unknown section name was passed.
108
+	 */
109
+	protected function setSectionName($section = null)
110
+	{
111
+		if (null === $section) {
112
+			throw new FailedToInitialiseSection(
113
+				'Initialised section without passing it a section name.'
114
+			);
115
+		}
116
+		if ( ! array_key_exists($section, $this->config['sections'])) {
117
+			throw new FailedToInitialiseSection(
118
+				'Initialised section with an unknown section name.'
119
+			);
120
+		}
121
+		$this->sectionName = $section;
122
+	}
123
+
124
+	/**
125
+	 * Render the current Renderable for a given context.
126
+	 *
127
+	 * @since 1.0.0
128
+	 *
129
+	 * @param array $context The context in which to render the Renderable.
130
+	 *
131
+	 * @return string Rendered output of the Renderable.
132
+	 * @throws RuntimeException
133
+	 */
134
+	public function render(array $context)
135
+	{
136
+
137
+		$viewName = $this->getViewName($context);
138
+		$view     = $this->viewBuilder->create($viewName);
139
+
140
+		$context['css_class'] = $this->getCSSClass();
141
+		$context['content']   = $this->content;
142
+
143
+		return $view->render($context);
144
+	}
145
+
146
+	/**
147
+	 * Get the name of the View to use for rendering.
148
+	 *
149
+	 * @since 1.0.0
150
+	 *
151
+	 * @param array $context The context in which to render the template.
152
+	 *
153
+	 * @return string Name of the view.
154
+	 */
155
+	protected function getViewName(array $context)
156
+	{
157
+		return $this->config['sections'][$this->getSectionName()]['view_name']
158
+			   . '.' . $context['format'];
159
+	}
160
+
161
+	/**
162
+	 * Get the CSS class that is used for the section.
163
+	 *
164
+	 * @since 1.0.0
165
+	 *
166
+	 * @return string
167
+	 */
168
+	protected function getCSSClass()
169
+	{
170
+		return $this->config['sections'][$this->getSectionName()]['css_class'];
171
+	}
172 172
 }
Please login to merge, or discard this patch.
src/Sanitizer.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -22,15 +22,15 @@
 block discarded – undo
22 22
 interface SanitizerInterface
23 23
 {
24 24
 
25
-    /**
26
-     * Sanitize 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);
25
+	/**
26
+	 * Sanitize 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 36
 }
Please login to merge, or discard this patch.
src/Template.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -22,21 +22,21 @@
 block discarded – undo
22 22
 interface TemplateInterface extends Renderable
23 23
 {
24 24
 
25
-    /**
26
-     * Get an array of Sections that are used by this template.
27
-     *
28
-     * @since 1.0.0
29
-     *
30
-     * @return array Sections that are used by this template.
31
-     */
32
-    public function getUsedSections();
25
+	/**
26
+	 * Get an array of Sections that are used by this template.
27
+	 *
28
+	 * @since 1.0.0
29
+	 *
30
+	 * @return array Sections that are used by this template.
31
+	 */
32
+	public function getUsedSections();
33 33
 
34
-    /**
35
-     * Get the name of the Template.
36
-     *
37
-     * @since 1.0.0
38
-     *
39
-     * @return string Name of the template.
40
-     */
41
-    public function getTemplateName();
34
+	/**
35
+	 * Get the name of the Template.
36
+	 *
37
+	 * @since 1.0.0
38
+	 *
39
+	 * @return string Name of the template.
40
+	 */
41
+	public function getTemplateName();
42 42
 }
Please login to merge, or discard this patch.
src/Section.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@
 block discarded – undo
22 22
 interface SectionInterface extends Renderable
23 23
 {
24 24
 
25
-    /**
26
-     * Get the name of the Section.
27
-     *
28
-     * @since 1.0.0
29
-     *
30
-     * @return string Name of the section.
31
-     */
32
-    public function getSectionName();
25
+	/**
26
+	 * Get the name of the Section.
27
+	 *
28
+	 * @since 1.0.0
29
+	 *
30
+	 * @return string Name of the section.
31
+	 */
32
+	public function getSectionName();
33 33
 }
Please login to merge, or discard this patch.
src/Support/Factory.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -26,75 +26,75 @@
 block discarded – undo
26 26
 class Factory
27 27
 {
28 28
 
29
-    /**
30
-     * Configuration Settings.
31
-     *
32
-     * @since 1.0.0
33
-     *
34
-     * @var ConfigInterface
35
-     */
36
-    protected $config;
29
+	/**
30
+	 * Configuration Settings.
31
+	 *
32
+	 * @since 1.0.0
33
+	 *
34
+	 * @var ConfigInterface
35
+	 */
36
+	protected $config;
37 37
 
38
-    /**
39
-     * Type of element the factory wants to create.
40
-     *
41
-     * @since 1.0.0
42
-     *
43
-     * @var string
44
-     */
45
-    protected $element;
38
+	/**
39
+	 * Type of element the factory wants to create.
40
+	 *
41
+	 * @since 1.0.0
42
+	 *
43
+	 * @var string
44
+	 */
45
+	protected $element;
46 46
 
47
-    /**
48
-     * Instantiate a Factory object.
49
-     *
50
-     * @since 1.0.0
51
-     *
52
-     * @param ConfigInterface $config  Configuration settings.
53
-     * @param string          $element The type of element to instantiate a factory for.
54
-     *
55
-     * @throws FailedToInstantiateFactory When an unknown element type is requested.
56
-     */
57
-    public function __construct(ConfigInterface $config, $element)
58
-    {
47
+	/**
48
+	 * Instantiate a Factory object.
49
+	 *
50
+	 * @since 1.0.0
51
+	 *
52
+	 * @param ConfigInterface $config  Configuration settings.
53
+	 * @param string          $element The type of element to instantiate a factory for.
54
+	 *
55
+	 * @throws FailedToInstantiateFactory When an unknown element type is requested.
56
+	 */
57
+	public function __construct(ConfigInterface $config, $element)
58
+	{
59 59
 
60
-        $this->config = $config;
60
+		$this->config = $config;
61 61
 
62
-        if ( ! $this->config->hasKey($element)) {
63
-            throw new FailedToInstantiateFactory(sprintf(
64
-                'Could not instantiate Factory for unknown Element Type "%1$s".',
65
-                $element
66
-            ));
67
-        }
62
+		if ( ! $this->config->hasKey($element)) {
63
+			throw new FailedToInstantiateFactory(sprintf(
64
+				'Could not instantiate Factory for unknown Element Type "%1$s".',
65
+				$element
66
+			));
67
+		}
68 68
 
69
-        $this->element = $element;
70
-    }
69
+		$this->element = $element;
70
+	}
71 71
 
72
-    /**
73
-     * Create and return a new instance of an element.
74
-     *
75
-     * @since 1.0.0
76
-     *
77
-     * @param string $type      Type of element to create.
78
-     * @param mixed  $arguments Optional. Arguments to pass to the object.
79
-     *
80
-     * @return object New instance of the requested class.
81
-     * @throws FailedToInstantiateClass If an unknown element type is requested.
82
-     */
83
-    public function create($type, $arguments = null)
84
-    {
72
+	/**
73
+	 * Create and return a new instance of an element.
74
+	 *
75
+	 * @since 1.0.0
76
+	 *
77
+	 * @param string $type      Type of element to create.
78
+	 * @param mixed  $arguments Optional. Arguments to pass to the object.
79
+	 *
80
+	 * @return object New instance of the requested class.
81
+	 * @throws FailedToInstantiateClass If an unknown element type is requested.
82
+	 */
83
+	public function create($type, $arguments = null)
84
+	{
85 85
 
86
-        $classMap = $this->config[$this->element];
86
+		$classMap = $this->config[$this->element];
87 87
 
88
-        if ( ! array_key_exists($type, $classMap)) {
89
-            throw new FailedToInstantiateClass(sprintf(
90
-                'Could not create object, unknown Type "%1$s" for "%2$s" elements.',
91
-                $type,
92
-                $this->element
93
-            ));
94
-        }
88
+		if ( ! array_key_exists($type, $classMap)) {
89
+			throw new FailedToInstantiateClass(sprintf(
90
+				'Could not create object, unknown Type "%1$s" for "%2$s" elements.',
91
+				$type,
92
+				$this->element
93
+			));
94
+		}
95 95
 
96
-        $className = $classMap[$type]['class_name'];
96
+		$className = $classMap[$type]['class_name'];
97 97
 
98
-        return new $className($this->config, $arguments);
99
-    }
98
+		return new $className($this->config, $arguments);
99
+	}
100 100
 }
Please login to merge, or discard this patch.
src/Template/AbstractTemplate.php 1 patch
Indentation   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -29,132 +29,132 @@
 block discarded – undo
29 29
 abstract class AbstractTemplate implements Template
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
-     * Name of the template.
43
-     *
44
-     * @since 1.0.0
45
-     *
46
-     * @var string
47
-     */
48
-    protected $templateName;
49
-
50
-    /**
51
-     * ViewBuilder to create template and section views.
52
-     *
53
-     * @since 1.0.0
54
-     *
55
-     * @var ViewBuilder
56
-     */
57
-    protected $viewBuilder;
58
-
59
-    /**
60
-     * Instantiate a AbstractTemplate object.
61
-     *
62
-     * @since 1.0.0
63
-     *
64
-     * @param ConfigInterface $config    Configuration settings.
65
-     * @param array           $arguments Arguments that are passed through the constructor.
66
-     *                                   Contained elements: string $template
67
-     *
68
-     * @throws RuntimeException
69
-     */
70
-    public function __construct($config, array $arguments)
71
-    {
72
-        $this->config = $config;
73
-        list($template, $this->viewBuilder) = $arguments;
74
-        $this->setTemplateName($template);
75
-    }
76
-
77
-    /**
78
-     * Get the name of the Template.
79
-     *
80
-     * @since 1.0.0
81
-     *
82
-     * @return string Name of the template.
83
-     */
84
-    public function getTemplateName()
85
-    {
86
-        return $this->templateName;
87
-    }
88
-
89
-    /**
90
-     * Set the name of the Template.
91
-     *
92
-     * @since 1.0.0
93
-     *
94
-     * @param string|null $template Optional. Name of the template.
95
-     *
96
-     * @throws FailedToInitialiseTemplate If no template name was passed.
97
-     * @throws FailedToInitialiseTemplate If an unknown template name was passed.
98
-     */
99
-    protected function setTemplateName($template = null)
100
-    {
101
-        if (null === $template) {
102
-            throw new FailedToInitialiseTemplate('Initialised template without passing it a template name.');
103
-        }
104
-        if ( ! array_key_exists($template, $this->config['templates'])) {
105
-            throw new FailedToInitialiseTemplate('Initialised template with an unknown template name.');
106
-        }
107
-        $this->templateName = $template;
108
-    }
109
-
110
-    /**
111
-     * Get an array of Sections that are used by this template.
112
-     *
113
-     * @since 1.0.0
114
-     *
115
-     * @return array Sections that are used by this template.
116
-     */
117
-    public function getUsedSections()
118
-    {
119
-        return $this->config['templates'][$this->getTemplateName()]['sections'];
120
-    }
121
-
122
-    /**
123
-     * Render the template for a given context.
124
-     *
125
-     * @since 1.0.0
126
-     *
127
-     * @param array $context The context in which to render the template.
128
-     *
129
-     * @return string The rendered content.
130
-     */
131
-    public function render(array $context)
132
-    {
133
-
134
-        $viewName = $this->getViewName($context);
135
-        $view     = $this->viewBuilder->create($viewName);
136
-
137
-        $sanitizerType    = $this->config['formats'][$context['format']]['sanitizer'];
138
-        $sanitizerFactory = new Factory($this->config, 'sanitizers');
139
-        $sanitizer        = $sanitizerFactory->create($sanitizerType);
140
-
141
-        $output = $view->render($context);
142
-
143
-        return $sanitizer->sanitize($output, $context);
144
-    }
145
-
146
-    /**
147
-     * Get the name of the View to use for rendering.
148
-     *
149
-     * @since 1.0.0
150
-     *
151
-     * @param array $context Context in which to get the view name.
152
-     *
153
-     * @return string Name of the view.
154
-     */
155
-    protected function getViewName(array $context)
156
-    {
157
-        return $this->config['templates'][$this->getTemplateName()]['view_name']
158
-               . '.' . $context['format'];
159
-    }
32
+	/**
33
+	 * Configuration Settings.
34
+	 *
35
+	 * @since 1.0.0
36
+	 *
37
+	 * @var ConfigInterface
38
+	 */
39
+	protected $config;
40
+
41
+	/**
42
+	 * Name of the template.
43
+	 *
44
+	 * @since 1.0.0
45
+	 *
46
+	 * @var string
47
+	 */
48
+	protected $templateName;
49
+
50
+	/**
51
+	 * ViewBuilder to create template and section views.
52
+	 *
53
+	 * @since 1.0.0
54
+	 *
55
+	 * @var ViewBuilder
56
+	 */
57
+	protected $viewBuilder;
58
+
59
+	/**
60
+	 * Instantiate a AbstractTemplate object.
61
+	 *
62
+	 * @since 1.0.0
63
+	 *
64
+	 * @param ConfigInterface $config    Configuration settings.
65
+	 * @param array           $arguments Arguments that are passed through the constructor.
66
+	 *                                   Contained elements: string $template
67
+	 *
68
+	 * @throws RuntimeException
69
+	 */
70
+	public function __construct($config, array $arguments)
71
+	{
72
+		$this->config = $config;
73
+		list($template, $this->viewBuilder) = $arguments;
74
+		$this->setTemplateName($template);
75
+	}
76
+
77
+	/**
78
+	 * Get the name of the Template.
79
+	 *
80
+	 * @since 1.0.0
81
+	 *
82
+	 * @return string Name of the template.
83
+	 */
84
+	public function getTemplateName()
85
+	{
86
+		return $this->templateName;
87
+	}
88
+
89
+	/**
90
+	 * Set the name of the Template.
91
+	 *
92
+	 * @since 1.0.0
93
+	 *
94
+	 * @param string|null $template Optional. Name of the template.
95
+	 *
96
+	 * @throws FailedToInitialiseTemplate If no template name was passed.
97
+	 * @throws FailedToInitialiseTemplate If an unknown template name was passed.
98
+	 */
99
+	protected function setTemplateName($template = null)
100
+	{
101
+		if (null === $template) {
102
+			throw new FailedToInitialiseTemplate('Initialised template without passing it a template name.');
103
+		}
104
+		if ( ! array_key_exists($template, $this->config['templates'])) {
105
+			throw new FailedToInitialiseTemplate('Initialised template with an unknown template name.');
106
+		}
107
+		$this->templateName = $template;
108
+	}
109
+
110
+	/**
111
+	 * Get an array of Sections that are used by this template.
112
+	 *
113
+	 * @since 1.0.0
114
+	 *
115
+	 * @return array Sections that are used by this template.
116
+	 */
117
+	public function getUsedSections()
118
+	{
119
+		return $this->config['templates'][$this->getTemplateName()]['sections'];
120
+	}
121
+
122
+	/**
123
+	 * Render the template for a given context.
124
+	 *
125
+	 * @since 1.0.0
126
+	 *
127
+	 * @param array $context The context in which to render the template.
128
+	 *
129
+	 * @return string The rendered content.
130
+	 */
131
+	public function render(array $context)
132
+	{
133
+
134
+		$viewName = $this->getViewName($context);
135
+		$view     = $this->viewBuilder->create($viewName);
136
+
137
+		$sanitizerType    = $this->config['formats'][$context['format']]['sanitizer'];
138
+		$sanitizerFactory = new Factory($this->config, 'sanitizers');
139
+		$sanitizer        = $sanitizerFactory->create($sanitizerType);
140
+
141
+		$output = $view->render($context);
142
+
143
+		return $sanitizer->sanitize($output, $context);
144
+	}
145
+
146
+	/**
147
+	 * Get the name of the View to use for rendering.
148
+	 *
149
+	 * @since 1.0.0
150
+	 *
151
+	 * @param array $context Context in which to get the view name.
152
+	 *
153
+	 * @return string Name of the view.
154
+	 */
155
+	protected function getViewName(array $context)
156
+	{
157
+		return $this->config['templates'][$this->getTemplateName()]['view_name']
158
+			   . '.' . $context['format'];
159
+	}
160 160
 }
Please login to merge, or discard this patch.
src/ChainMail.php 1 patch
Indentation   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -26,114 +26,114 @@
 block discarded – undo
26 26
 class ChainMail
27 27
 {
28 28
 
29
-    const DEFAULT_CONFIG = __DIR__ . '/../config/defaults.php';
30
-
31
-    /**
32
-     * Configuration Settings.
33
-     *
34
-     * @since 1.0.0
35
-     *
36
-     * @var ConfigInterface
37
-     */
38
-    protected $config;
39
-
40
-    /**
41
-     * Instantiate a ChainMail object.
42
-     *
43
-     * @since 1.0.0
44
-     *
45
-     * @param ConfigInterface|null $config Optional. Configuration settings.
46
-     */
47
-    public function __construct(ConfigInterface $config = null)
48
-    {
49
-
50
-        $defaults = ConfigFactory::create(include(self::DEFAULT_CONFIG));
51
-
52
-        if ( ! $config) {
53
-            $this->config = $defaults;
54
-
55
-            return;
56
-        }
57
-
58
-        $this->config = ConfigFactory::create(array_replace_recursive(
59
-                (array)$defaults,
60
-                (array)$config)
61
-        );
62
-    }
63
-
64
-    /**
65
-     * Render a specific section.
66
-     *
67
-     * @since 1.0.0
68
-     *
69
-     * @param string $sectionType Type of section to render.
70
-     * @param array  $context     The context in which to render the section.
71
-     *
72
-     * @return string Rendered HTML.
73
-     */
74
-    public static function renderSection($sectionType, array $context)
75
-    {
76
-        /** @var Section $section */
77
-        $section = $context['sections'][$sectionType];
78
-
79
-        return $section->render($context);
80
-    }
81
-
82
-    /**
83
-     * Get an array of strings representing the sections that are used by the
84
-     * template.
85
-     *
86
-     * @since 1.0.0
87
-     *
88
-     * @param array $context The context in which to render the section.
89
-     *
90
-     * @return array Array of strings with section types.
91
-     */
92
-    public static function getUsedSections(array $context)
93
-    {
94
-        /** @var Template $template */
95
-        $template = $context['template'];
96
-
97
-        return $template->getUsedSections();
98
-    }
99
-
100
-    /**
101
-     * Render all used sections.
102
-     *
103
-     * @since 1.0.0
104
-     *
105
-     * @param array $context The context in which to render the section.
106
-     *
107
-     * @return string Rendered HTML.
108
-     */
109
-    public static function renderSections(array $context)
110
-    {
111
-        $output = '';
112
-
113
-        foreach (self::getUsedSections($context) as $section) {
114
-            $output .= self::renderSection($section, $context);
115
-        }
116
-
117
-        return $output;
118
-    }
119
-
120
-    /**
121
-     * Create a new mail object.
122
-     *
123
-     * @since 1.0.0
124
-     *
125
-     * @param string          $format   Optional. Format to use.
126
-     * @param string|Template $template Optional. Template to be used.
127
-     *
128
-     * @return Mail
129
-     */
130
-    public function createMail($format = 'html', $template = 'BasicTemplate')
131
-    {
132
-        $mail_factory = new Factory($this->config, 'mails');
133
-        $mail_class   = $this->config->getKey('formats')[$format]['mail'];
134
-        $mail         = $mail_factory->create($mail_class);
135
-        $mail->setTemplate($template);
136
-
137
-        return $mail;
138
-    }
29
+	const DEFAULT_CONFIG = __DIR__ . '/../config/defaults.php';
30
+
31
+	/**
32
+	 * Configuration Settings.
33
+	 *
34
+	 * @since 1.0.0
35
+	 *
36
+	 * @var ConfigInterface
37
+	 */
38
+	protected $config;
39
+
40
+	/**
41
+	 * Instantiate a ChainMail object.
42
+	 *
43
+	 * @since 1.0.0
44
+	 *
45
+	 * @param ConfigInterface|null $config Optional. Configuration settings.
46
+	 */
47
+	public function __construct(ConfigInterface $config = null)
48
+	{
49
+
50
+		$defaults = ConfigFactory::create(include(self::DEFAULT_CONFIG));
51
+
52
+		if ( ! $config) {
53
+			$this->config = $defaults;
54
+
55
+			return;
56
+		}
57
+
58
+		$this->config = ConfigFactory::create(array_replace_recursive(
59
+				(array)$defaults,
60
+				(array)$config)
61
+		);
62
+	}
63
+
64
+	/**
65
+	 * Render a specific section.
66
+	 *
67
+	 * @since 1.0.0
68
+	 *
69
+	 * @param string $sectionType Type of section to render.
70
+	 * @param array  $context     The context in which to render the section.
71
+	 *
72
+	 * @return string Rendered HTML.
73
+	 */
74
+	public static function renderSection($sectionType, array $context)
75
+	{
76
+		/** @var Section $section */
77
+		$section = $context['sections'][$sectionType];
78
+
79
+		return $section->render($context);
80
+	}
81
+
82
+	/**
83
+	 * Get an array of strings representing the sections that are used by the
84
+	 * template.
85
+	 *
86
+	 * @since 1.0.0
87
+	 *
88
+	 * @param array $context The context in which to render the section.
89
+	 *
90
+	 * @return array Array of strings with section types.
91
+	 */
92
+	public static function getUsedSections(array $context)
93
+	{
94
+		/** @var Template $template */
95
+		$template = $context['template'];
96
+
97
+		return $template->getUsedSections();
98
+	}
99
+
100
+	/**
101
+	 * Render all used sections.
102
+	 *
103
+	 * @since 1.0.0
104
+	 *
105
+	 * @param array $context The context in which to render the section.
106
+	 *
107
+	 * @return string Rendered HTML.
108
+	 */
109
+	public static function renderSections(array $context)
110
+	{
111
+		$output = '';
112
+
113
+		foreach (self::getUsedSections($context) as $section) {
114
+			$output .= self::renderSection($section, $context);
115
+		}
116
+
117
+		return $output;
118
+	}
119
+
120
+	/**
121
+	 * Create a new mail object.
122
+	 *
123
+	 * @since 1.0.0
124
+	 *
125
+	 * @param string          $format   Optional. Format to use.
126
+	 * @param string|Template $template Optional. Template to be used.
127
+	 *
128
+	 * @return Mail
129
+	 */
130
+	public function createMail($format = 'html', $template = 'BasicTemplate')
131
+	{
132
+		$mail_factory = new Factory($this->config, 'mails');
133
+		$mail_class   = $this->config->getKey('formats')[$format]['mail'];
134
+		$mail         = $mail_factory->create($mail_class);
135
+		$mail->setTemplate($template);
136
+
137
+		return $mail;
138
+	}
139 139
 }
Please login to merge, or discard this patch.
src/Exception/InvalidEmailAddress.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -24,15 +24,15 @@
 block discarded – undo
24 24
 class InvalidEmailAddress extends RuntimeException implements ChainmailException
25 25
 {
26 26
 
27
-    /**
28
-     * Create an InvalidEmailAddress exception based on a specific email.
29
-     *
30
-     * @param string $email Email that failed validation.
31
-     *
32
-     * @return static
33
-     */
34
-    public static function from($email)
35
-    {
36
-        return new static(sprintf('Invalid email address: "%1$s".', $email));
37
-    }
27
+	/**
28
+	 * Create an InvalidEmailAddress exception based on a specific email.
29
+	 *
30
+	 * @param string $email Email that failed validation.
31
+	 *
32
+	 * @return static
33
+	 */
34
+	public static function from($email)
35
+	{
36
+		return new static(sprintf('Invalid email address: "%1$s".', $email));
37
+	}
38 38
 }
Please login to merge, or discard this patch.