Test Failed
Push — master ( 90a3be...261c05 )
by Alain
06:34
created
src/View/Support/Extensions.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -24,24 +24,24 @@
 block discarded – undo
24 24
 class Extensions extends ArrayCollection
25 25
 {
26 26
 
27
-    /**
28
-     * Check whether a given URI has a specific extension.
29
-     *
30
-     * @since 0.1.0
31
-     *
32
-     * @param string $uri       URI to check the extension of.
33
-     * @param string $extension Extension to check for.
34
-     *
35
-     * @return bool
36
-     */
37
-    public static function hasExtension(string $uri, string $extension): bool
38
-    {
39
-        $uriLength       = mb_strlen($uri);
40
-        $extensionLength = mb_strlen($extension);
41
-        if ($extensionLength > $uriLength) {
42
-            return false;
43
-        }
27
+	/**
28
+	 * Check whether a given URI has a specific extension.
29
+	 *
30
+	 * @since 0.1.0
31
+	 *
32
+	 * @param string $uri       URI to check the extension of.
33
+	 * @param string $extension Extension to check for.
34
+	 *
35
+	 * @return bool
36
+	 */
37
+	public static function hasExtension(string $uri, string $extension): bool
38
+	{
39
+		$uriLength       = mb_strlen($uri);
40
+		$extensionLength = mb_strlen($extension);
41
+		if ($extensionLength > $uriLength) {
42
+			return false;
43
+		}
44 44
 
45
-        return substr_compare($uri, $extension, $uriLength - $extensionLength, $extensionLength) === 0;
46
-    }
45
+		return substr_compare($uri, $extension, $uriLength - $extensionLength, $extensionLength) === 0;
46
+	}
47 47
 }
Please login to merge, or discard this patch.
src/View/Support/AbstractFinder.php 2 patches
Indentation   +211 added lines, -211 removed lines patch added patch discarded remove patch
@@ -27,215 +27,215 @@
 block discarded – undo
27 27
 abstract class AbstractFinder implements Finder
28 28
 {
29 29
 
30
-    use ConfigTrait;
31
-
32
-    /**
33
-     * Findable collection that the Finder can iterate through to find a match.
34
-     *
35
-     * @since 0.1.0
36
-     *
37
-     * @var Findables
38
-     */
39
-    protected $findables;
40
-
41
-    /**
42
-     * NullObject that is returned if the Finder could not find a match.
43
-     *
44
-     * @since 0.1.0
45
-     *
46
-     * @var NullFindable
47
-     */
48
-    protected $nullObject;
49
-
50
-    /**
51
-     * Instantiate an AbstractFinder object.
52
-     *
53
-     * @since 0.1.0
54
-     *
55
-     * @param ConfigInterface $config Configuration of the AbstractFinder.
56
-     *
57
-     * @throws FailedToProcessConfigException If the config could not be processed.
58
-     */
59
-    public function __construct(ConfigInterface $config)
60
-    {
61
-        $this->processConfig($config);
62
-        $this->findables = new Findables();
63
-        $this->registerFindables($this->config);
64
-        $this->registerNullObject($this->config);
65
-    }
66
-
67
-    /**
68
-     * Register the Findables defined in the given configuration.
69
-     *
70
-     * @since 0.1.0
71
-     *
72
-     * @param ConfigInterface $config Configuration to register the Findables from.
73
-     */
74
-    public function registerFindables(ConfigInterface $config)
75
-    {
76
-        $findables = (array) $config->getKey($this->getFindablesConfigKey());
77
-        foreach ($findables as $findableKey => $findableObject) {
78
-            $this->findables->set($findableKey, $findableObject);
79
-        }
80
-    }
81
-
82
-    /**
83
-     * Register the NullObject defined in the given configuration.
84
-     *
85
-     * @since 0.1.0
86
-     *
87
-     * @param ConfigInterface $config Configuration to register the NullObject from.
88
-     */
89
-    public function registerNullObject(ConfigInterface $config)
90
-    {
91
-        $this->nullObject = $config->getKey($this->getNullObjectConfigKey());
92
-    }
93
-
94
-    /**
95
-     * Get the NullObject.
96
-     *
97
-     * @since 0.1.1
98
-     *
99
-     * @return NullFindable NullObject for the current Finder.
100
-     * @throws FailedToInstantiateFindable If the Findable could not be instantiated.
101
-     */
102
-    public function getNullObject(): NullFindable
103
-    {
104
-        $this->initializeNullObject();
105
-
106
-        return $this->nullObject;
107
-    }
108
-
109
-    /**
110
-     * Get the config key for the Findables definitions.
111
-     *
112
-     * @since 0.1.0
113
-     *
114
-     * @return string Config key use to define the Findables.
115
-     */
116
-    protected function getFindablesConfigKey(): string
117
-    {
118
-        return 'Findables';
119
-    }
120
-
121
-    /**
122
-     * Get the config key for the NullObject definitions.
123
-     *
124
-     * @since 0.1.0
125
-     *
126
-     * @return string Config key use to define the NullObject.
127
-     */
128
-    protected function getNullObjectConfigKey(): string
129
-    {
130
-        return 'NullObject';
131
-    }
132
-
133
-    /**
134
-     * Initialize the NullObject.
135
-     *
136
-     * @since 0.1.1
137
-     *
138
-     * @param mixed $arguments Optional. Arguments to use.
139
-     *
140
-     * @throws FailedToInstantiateFindable If the Findable could not be instantiated.
141
-     */
142
-    protected function initializeNullObject($arguments = null)
143
-    {
144
-        $this->nullObject = $this->maybeInstantiateFindable($this->nullObject, $arguments);
145
-    }
146
-
147
-    /**
148
-     * Initialize the Findables that can be iterated.
149
-     *
150
-     * @param mixed $arguments Optional. Arguments to use.
151
-     *
152
-     * @since 0.1.0
153
-     *
154
-     * @throws FailedToInstantiateFindable If the Findable could not be instantiated.
155
-     */
156
-    protected function initializeFindables($arguments = null)
157
-    {
158
-        $this->findables = $this->findables->map(function ($findable) use ($arguments) {
159
-            return $this->initializeFindable($findable, $arguments);
160
-        });
161
-    }
162
-
163
-    /**
164
-     * Initialize a single findable by instantiating class name strings and calling closures.
165
-     *
166
-     * @since 0.1.0
167
-     *
168
-     * @param mixed $findable  Findable to instantiate.
169
-     * @param mixed $arguments Optional. Arguments to use.
170
-     *
171
-     * @return Findable Instantiated findable.
172
-     * @throws FailedToInstantiateFindable If the Findable could not be instantiated.
173
-     */
174
-    protected function initializeFindable($findable, $arguments = null): Findable
175
-    {
176
-        return $this->maybeInstantiateFindable($findable, $arguments);
177
-    }
178
-
179
-    /**
180
-     * Maybe instantiate a Findable if it is not yet an object.
181
-     *
182
-     * @since 0.1.1
183
-     *
184
-     * @param mixed $findable  Findable to instantiate.
185
-     * @param mixed $arguments Optional. Arguments to use.
186
-     *
187
-     * @return Findable Instantiated findable.
188
-     * @throws FailedToInstantiateFindable If the findable could not be instantiated.
189
-     */
190
-    protected function maybeInstantiateFindable($findable, $arguments = null): Findable
191
-    {
192
-        if (is_string($findable)) {
193
-            $findable = $this->instantiateFindableFromString($findable, $arguments);
194
-        }
195
-
196
-        if (is_callable($findable)) {
197
-            $findable = $this->instantiateFindableFromCallable($findable, $arguments);
198
-        }
199
-
200
-        if (! $findable instanceof Findable) {
201
-            throw new FailedToInstantiateFindable(
202
-                sprintf(
203
-                    _('Could not instantiate Findable "%s".'),
204
-                    serialize($findable)
205
-                )
206
-            );
207
-        }
208
-
209
-        return $findable;
210
-    }
211
-
212
-    /**
213
-     * Instantiate a Findable from a string.
214
-     *
215
-     * @since 0.1.1
216
-     *
217
-     * @param string $string    String to use for instantiation.
218
-     * @param mixed  $arguments Optional. Arguments to use for instantiation.
219
-     *
220
-     * @return Findable Instantiated Findable.
221
-     */
222
-    protected function instantiateFindableFromString(string $string, $arguments = []): Findable
223
-    {
224
-        return new $string(...(array)$arguments);
225
-    }
226
-
227
-    /**
228
-     * Instantiate a Findable from a callable.
229
-     *
230
-     * @since 0.1.1
231
-     *
232
-     * @param callable $callable  Callable to use for instantiation.
233
-     * @param mixed    $arguments Optional. Arguments to use for instantiation.
234
-     *
235
-     * @return Findable Instantiated Findable.
236
-     */
237
-    protected function instantiateFindableFromCallable(callable $callable, $arguments = []): Findable
238
-    {
239
-        return $callable(...(array)$arguments);
240
-    }
30
+	use ConfigTrait;
31
+
32
+	/**
33
+	 * Findable collection that the Finder can iterate through to find a match.
34
+	 *
35
+	 * @since 0.1.0
36
+	 *
37
+	 * @var Findables
38
+	 */
39
+	protected $findables;
40
+
41
+	/**
42
+	 * NullObject that is returned if the Finder could not find a match.
43
+	 *
44
+	 * @since 0.1.0
45
+	 *
46
+	 * @var NullFindable
47
+	 */
48
+	protected $nullObject;
49
+
50
+	/**
51
+	 * Instantiate an AbstractFinder object.
52
+	 *
53
+	 * @since 0.1.0
54
+	 *
55
+	 * @param ConfigInterface $config Configuration of the AbstractFinder.
56
+	 *
57
+	 * @throws FailedToProcessConfigException If the config could not be processed.
58
+	 */
59
+	public function __construct(ConfigInterface $config)
60
+	{
61
+		$this->processConfig($config);
62
+		$this->findables = new Findables();
63
+		$this->registerFindables($this->config);
64
+		$this->registerNullObject($this->config);
65
+	}
66
+
67
+	/**
68
+	 * Register the Findables defined in the given configuration.
69
+	 *
70
+	 * @since 0.1.0
71
+	 *
72
+	 * @param ConfigInterface $config Configuration to register the Findables from.
73
+	 */
74
+	public function registerFindables(ConfigInterface $config)
75
+	{
76
+		$findables = (array) $config->getKey($this->getFindablesConfigKey());
77
+		foreach ($findables as $findableKey => $findableObject) {
78
+			$this->findables->set($findableKey, $findableObject);
79
+		}
80
+	}
81
+
82
+	/**
83
+	 * Register the NullObject defined in the given configuration.
84
+	 *
85
+	 * @since 0.1.0
86
+	 *
87
+	 * @param ConfigInterface $config Configuration to register the NullObject from.
88
+	 */
89
+	public function registerNullObject(ConfigInterface $config)
90
+	{
91
+		$this->nullObject = $config->getKey($this->getNullObjectConfigKey());
92
+	}
93
+
94
+	/**
95
+	 * Get the NullObject.
96
+	 *
97
+	 * @since 0.1.1
98
+	 *
99
+	 * @return NullFindable NullObject for the current Finder.
100
+	 * @throws FailedToInstantiateFindable If the Findable could not be instantiated.
101
+	 */
102
+	public function getNullObject(): NullFindable
103
+	{
104
+		$this->initializeNullObject();
105
+
106
+		return $this->nullObject;
107
+	}
108
+
109
+	/**
110
+	 * Get the config key for the Findables definitions.
111
+	 *
112
+	 * @since 0.1.0
113
+	 *
114
+	 * @return string Config key use to define the Findables.
115
+	 */
116
+	protected function getFindablesConfigKey(): string
117
+	{
118
+		return 'Findables';
119
+	}
120
+
121
+	/**
122
+	 * Get the config key for the NullObject definitions.
123
+	 *
124
+	 * @since 0.1.0
125
+	 *
126
+	 * @return string Config key use to define the NullObject.
127
+	 */
128
+	protected function getNullObjectConfigKey(): string
129
+	{
130
+		return 'NullObject';
131
+	}
132
+
133
+	/**
134
+	 * Initialize the NullObject.
135
+	 *
136
+	 * @since 0.1.1
137
+	 *
138
+	 * @param mixed $arguments Optional. Arguments to use.
139
+	 *
140
+	 * @throws FailedToInstantiateFindable If the Findable could not be instantiated.
141
+	 */
142
+	protected function initializeNullObject($arguments = null)
143
+	{
144
+		$this->nullObject = $this->maybeInstantiateFindable($this->nullObject, $arguments);
145
+	}
146
+
147
+	/**
148
+	 * Initialize the Findables that can be iterated.
149
+	 *
150
+	 * @param mixed $arguments Optional. Arguments to use.
151
+	 *
152
+	 * @since 0.1.0
153
+	 *
154
+	 * @throws FailedToInstantiateFindable If the Findable could not be instantiated.
155
+	 */
156
+	protected function initializeFindables($arguments = null)
157
+	{
158
+		$this->findables = $this->findables->map(function ($findable) use ($arguments) {
159
+			return $this->initializeFindable($findable, $arguments);
160
+		});
161
+	}
162
+
163
+	/**
164
+	 * Initialize a single findable by instantiating class name strings and calling closures.
165
+	 *
166
+	 * @since 0.1.0
167
+	 *
168
+	 * @param mixed $findable  Findable to instantiate.
169
+	 * @param mixed $arguments Optional. Arguments to use.
170
+	 *
171
+	 * @return Findable Instantiated findable.
172
+	 * @throws FailedToInstantiateFindable If the Findable could not be instantiated.
173
+	 */
174
+	protected function initializeFindable($findable, $arguments = null): Findable
175
+	{
176
+		return $this->maybeInstantiateFindable($findable, $arguments);
177
+	}
178
+
179
+	/**
180
+	 * Maybe instantiate a Findable if it is not yet an object.
181
+	 *
182
+	 * @since 0.1.1
183
+	 *
184
+	 * @param mixed $findable  Findable to instantiate.
185
+	 * @param mixed $arguments Optional. Arguments to use.
186
+	 *
187
+	 * @return Findable Instantiated findable.
188
+	 * @throws FailedToInstantiateFindable If the findable could not be instantiated.
189
+	 */
190
+	protected function maybeInstantiateFindable($findable, $arguments = null): Findable
191
+	{
192
+		if (is_string($findable)) {
193
+			$findable = $this->instantiateFindableFromString($findable, $arguments);
194
+		}
195
+
196
+		if (is_callable($findable)) {
197
+			$findable = $this->instantiateFindableFromCallable($findable, $arguments);
198
+		}
199
+
200
+		if (! $findable instanceof Findable) {
201
+			throw new FailedToInstantiateFindable(
202
+				sprintf(
203
+					_('Could not instantiate Findable "%s".'),
204
+					serialize($findable)
205
+				)
206
+			);
207
+		}
208
+
209
+		return $findable;
210
+	}
211
+
212
+	/**
213
+	 * Instantiate a Findable from a string.
214
+	 *
215
+	 * @since 0.1.1
216
+	 *
217
+	 * @param string $string    String to use for instantiation.
218
+	 * @param mixed  $arguments Optional. Arguments to use for instantiation.
219
+	 *
220
+	 * @return Findable Instantiated Findable.
221
+	 */
222
+	protected function instantiateFindableFromString(string $string, $arguments = []): Findable
223
+	{
224
+		return new $string(...(array)$arguments);
225
+	}
226
+
227
+	/**
228
+	 * Instantiate a Findable from a callable.
229
+	 *
230
+	 * @since 0.1.1
231
+	 *
232
+	 * @param callable $callable  Callable to use for instantiation.
233
+	 * @param mixed    $arguments Optional. Arguments to use for instantiation.
234
+	 *
235
+	 * @return Findable Instantiated Findable.
236
+	 */
237
+	protected function instantiateFindableFromCallable(callable $callable, $arguments = []): Findable
238
+	{
239
+		return $callable(...(array)$arguments);
240
+	}
241 241
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
      */
156 156
     protected function initializeFindables($arguments = null)
157 157
     {
158
-        $this->findables = $this->findables->map(function ($findable) use ($arguments) {
158
+        $this->findables = $this->findables->map(function($findable) use ($arguments) {
159 159
             return $this->initializeFindable($findable, $arguments);
160 160
         });
161 161
     }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             $findable = $this->instantiateFindableFromCallable($findable, $arguments);
198 198
         }
199 199
 
200
-        if (! $findable instanceof Findable) {
200
+        if ( ! $findable instanceof Findable) {
201 201
             throw new FailedToInstantiateFindable(
202 202
                 sprintf(
203 203
                     _('Could not instantiate Findable "%s".'),
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
      */
222 222
     protected function instantiateFindableFromString(string $string, $arguments = []): Findable
223 223
     {
224
-        return new $string(...(array)$arguments);
224
+        return new $string(...(array) $arguments);
225 225
     }
226 226
 
227 227
     /**
@@ -236,6 +236,6 @@  discard block
 block discarded – undo
236 236
      */
237 237
     protected function instantiateFindableFromCallable(callable $callable, $arguments = []): Findable
238 238
     {
239
-        return $callable(...(array)$arguments);
239
+        return $callable(...(array) $arguments);
240 240
     }
241 241
 }
Please login to merge, or discard this patch.
src/View/View.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -24,58 +24,58 @@
 block discarded – undo
24 24
 interface View extends Findable
25 25
 {
26 26
 
27
-    /**
28
-     * Check whether the Findable can handle an individual criterion.
29
-     *
30
-     * @since 0.1.0
31
-     *
32
-     * @param mixed $criterion Criterion to check.
33
-     *
34
-     * @return bool Whether the Findable can handle the criterion.
35
-     */
36
-    public function canHandle($criterion): bool;
27
+	/**
28
+	 * Check whether the Findable can handle an individual criterion.
29
+	 *
30
+	 * @since 0.1.0
31
+	 *
32
+	 * @param mixed $criterion Criterion to check.
33
+	 *
34
+	 * @return bool Whether the Findable can handle the criterion.
35
+	 */
36
+	public function canHandle($criterion): bool;
37 37
 
38
-    /**
39
-     * Render the view.
40
-     *
41
-     * @since 0.1.0
42
-     *
43
-     * @param array $context Optional. The context in which to render the view.
44
-     *
45
-     * @return string Rendered HTML.
46
-     */
47
-    public function render(array $context = []): string;
38
+	/**
39
+	 * Render the view.
40
+	 *
41
+	 * @since 0.1.0
42
+	 *
43
+	 * @param array $context Optional. The context in which to render the view.
44
+	 *
45
+	 * @return string Rendered HTML.
46
+	 */
47
+	public function render(array $context = []): string;
48 48
 
49
-    /**
50
-     * Render a partial view (or section) for a given URI.
51
-     *
52
-     * @since 0.2.0
53
-     *
54
-     * @param string      $view    View identifier to create a view for.
55
-     * @param array       $context Optional. The context in which to render the view.
56
-     * @param string|null $type    Type of view to create.
57
-     *
58
-     * @return string Rendered HTML content.
59
-     */
60
-    public function section(string $view, array $context = [], $type = null): string;
49
+	/**
50
+	 * Render a partial view (or section) for a given URI.
51
+	 *
52
+	 * @since 0.2.0
53
+	 *
54
+	 * @param string      $view    View identifier to create a view for.
55
+	 * @param array       $context Optional. The context in which to render the view.
56
+	 * @param string|null $type    Type of view to create.
57
+	 *
58
+	 * @return string Rendered HTML content.
59
+	 */
60
+	public function section(string $view, array $context = [], $type = null): string;
61 61
 
62
-    /**
63
-     * Get the entire array of contextual data.
64
-     *
65
-     * @since 0.4.0
66
-     *
67
-     * @return array Array of contextual data.
68
-     */
69
-    public function getContext(): array;
62
+	/**
63
+	 * Get the entire array of contextual data.
64
+	 *
65
+	 * @since 0.4.0
66
+	 *
67
+	 * @return array Array of contextual data.
68
+	 */
69
+	public function getContext(): array;
70 70
 
71
-    /**
72
-     * Associate a view builder with this view.
73
-     *
74
-     * @since 0.2.0
75
-     *
76
-     * @param ViewBuilder $builder
77
-     *
78
-     * @return View
79
-     */
80
-    public function setBuilder(ViewBuilder $builder): View;
71
+	/**
72
+	 * Associate a view builder with this view.
73
+	 *
74
+	 * @since 0.2.0
75
+	 *
76
+	 * @param ViewBuilder $builder
77
+	 *
78
+	 * @return View
79
+	 */
80
+	public function setBuilder(ViewBuilder $builder): View;
81 81
 }
Please login to merge, or discard this patch.
src/View/View/BaseView.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@
 block discarded – undo
22 22
 class BaseView extends AbstractView
23 23
 {
24 24
 
25
-    /**
26
-     * Check whether the Findable can handle an individual criterion.
27
-     *
28
-     * @since 0.1.0
29
-     *
30
-     * @param mixed $criterion Criterion to check.
31
-     *
32
-     * @return bool Whether the Findable can handle the criterion.
33
-     */
34
-    public function canHandle($criterion): bool
35
-    {
36
-        return true;
37
-    }
25
+	/**
26
+	 * Check whether the Findable can handle an individual criterion.
27
+	 *
28
+	 * @since 0.1.0
29
+	 *
30
+	 * @param mixed $criterion Criterion to check.
31
+	 *
32
+	 * @return bool Whether the Findable can handle the criterion.
33
+	 */
34
+	public function canHandle($criterion): bool
35
+	{
36
+		return true;
37
+	}
38 38
 }
Please login to merge, or discard this patch.
src/View/View/ViewFinder.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -26,20 +26,20 @@
 block discarded – undo
26 26
 interface ViewFinder extends Finder
27 27
 {
28 28
 
29
-    // Constants to be used for the Config file sections.
30
-    const CLASS_NAME_KEY = 'ClassName';
31
-    const VIEWS_KEY = 'Views';
32
-    const NULL_OBJECT = 'NullObject';
29
+	// Constants to be used for the Config file sections.
30
+	const CLASS_NAME_KEY = 'ClassName';
31
+	const VIEWS_KEY = 'Views';
32
+	const NULL_OBJECT = 'NullObject';
33 33
 
34
-    /**
35
-     * Find a result based on a specific criteria.
36
-     *
37
-     * @since 0.1.0
38
-     *
39
-     * @param array       $criteria Criteria to search for.
40
-     * @param Engine|null $engine   Optional. Engine to use with the view.
41
-     *
42
-     * @return View View that was found.
43
-     */
44
-    public function find(array $criteria, Engine $engine = null): View;
34
+	/**
35
+	 * Find a result based on a specific criteria.
36
+	 *
37
+	 * @since 0.1.0
38
+	 *
39
+	 * @param array       $criteria Criteria to search for.
40
+	 * @param Engine|null $engine   Optional. Engine to use with the view.
41
+	 *
42
+	 * @return View View that was found.
43
+	 */
44
+	public function find(array $criteria, Engine $engine = null): View;
45 45
 }
Please login to merge, or discard this patch.
src/View/View/BaseViewFinder.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -27,43 +27,43 @@
 block discarded – undo
27 27
 class BaseViewFinder extends AbstractFinder implements ViewFinder
28 28
 {
29 29
 
30
-    /**
31
-     * Find a result based on a specific criteria.
32
-     *
33
-     * @since 0.1.0
34
-     *
35
-     * @param array       $criteria Criteria to search for.
36
-     * @param Engine|null $engine   Optional. Engine to use with the view.
37
-     *
38
-     * @return View View that was found.
39
-     * @throws FailedToInstantiateFindable If the Findable could not be instantiated.
40
-     */
41
-    public function find(array $criteria, Engine $engine = null): View
42
-    {
43
-        $uri = $criteria[0];
30
+	/**
31
+	 * Find a result based on a specific criteria.
32
+	 *
33
+	 * @since 0.1.0
34
+	 *
35
+	 * @param array       $criteria Criteria to search for.
36
+	 * @param Engine|null $engine   Optional. Engine to use with the view.
37
+	 *
38
+	 * @return View View that was found.
39
+	 * @throws FailedToInstantiateFindable If the Findable could not be instantiated.
40
+	 */
41
+	public function find(array $criteria, Engine $engine = null): View
42
+	{
43
+		$uri = $criteria[0];
44 44
 
45
-        $this->initializeFindables([$uri, $engine]);
45
+		$this->initializeFindables([$uri, $engine]);
46 46
 
47
-        foreach ($criteria as $entry) {
48
-            foreach ($this->findables as $viewObject) {
49
-                if ($viewObject->canHandle($entry)) {
50
-                    return $viewObject;
51
-                }
52
-            }
53
-        }
47
+		foreach ($criteria as $entry) {
48
+			foreach ($this->findables as $viewObject) {
49
+				if ($viewObject->canHandle($entry)) {
50
+					return $viewObject;
51
+				}
52
+			}
53
+		}
54 54
 
55
-        return $this->getNullObject();
56
-    }
55
+		return $this->getNullObject();
56
+	}
57 57
 
58
-    /**
59
-     * Get the config key for the Findables definitions.
60
-     *
61
-     * @since 0.1.0
62
-     *
63
-     * @return string Config key use to define the Findables.
64
-     */
65
-    protected function getFindablesConfigKey(): string
66
-    {
67
-        return 'Views';
68
-    }
58
+	/**
59
+	 * Get the config key for the Findables definitions.
60
+	 *
61
+	 * @since 0.1.0
62
+	 *
63
+	 * @return string Config key use to define the Findables.
64
+	 */
65
+	protected function getFindablesConfigKey(): string
66
+	{
67
+		return 'Views';
68
+	}
69 69
 }
Please login to merge, or discard this patch.
src/View/View/AbstractView.php 1 patch
Indentation   +170 added lines, -170 removed lines patch added patch discarded remove patch
@@ -30,174 +30,174 @@
 block discarded – undo
30 30
 abstract class AbstractView implements View
31 31
 {
32 32
 
33
-    /**
34
-     * URI of the view.
35
-     *
36
-     * The underscores are used to prevent accidental use of these properties from within the rendering closure.
37
-     *
38
-     * @since 0.1.0
39
-     *
40
-     * @var string
41
-     */
42
-    protected $_uri_;
43
-
44
-    /**
45
-     * Engine to use for the view.
46
-     *
47
-     * The underscores are used to prevent accidental use of these properties from within the rendering closure.
48
-     *
49
-     * @since 0.1.0
50
-     *
51
-     * @var Engine
52
-     */
53
-    protected $_engine_;
54
-
55
-    /**
56
-     * ViewBuilder instance.
57
-     *
58
-     * The underscores are used to prevent accidental use of these properties from within the rendering closure.
59
-     *
60
-     * @since 0.2.0
61
-     *
62
-     * @var ViewBuilder
63
-     */
64
-    protected $_builder_;
65
-
66
-    /**
67
-     * The context with which the view will be rendered.
68
-     *
69
-     * The underscores are used to prevent accidental use of these properties from within the rendering closure.
70
-     *
71
-     * @since 0.4.0
72
-     *
73
-     * @var array
74
-     */
75
-    protected $_context_ = [];
76
-
77
-    /**
78
-     * Instantiate an AbstractView object.
79
-     *
80
-     * @since 0.1.0
81
-     *
82
-     * @param string $uri    URI for the view.
83
-     * @param Engine $engine Engine to use for the view.
84
-     */
85
-    public function __construct(string $uri, Engine $engine)
86
-    {
87
-        $this->_uri_    = $uri;
88
-        $this->_engine_ = $engine;
89
-    }
90
-
91
-    /**
92
-     * Render the view.
93
-     *
94
-     * @since 0.1.0
95
-     *
96
-     * @param array $context Optional. The context in which to render the view.
97
-     * @param bool  $echo    Optional. Whether to echo the output immediately. Defaults to false.
98
-     *
99
-     * @return string Rendered HTML.
100
-     * @throws FailedToProcessConfigException If the Config could not be processed.
101
-     */
102
-    public function render(array $context = [], bool $echo = false): string
103
-    {
104
-        $this->initializeViewBuilder();
105
-        $this->assimilateContext($context);
106
-
107
-        $closure = Closure::bind(
108
-            $this->_engine_->getRenderCallback($this->_uri_, $context),
109
-            $this,
110
-            static::class
111
-        );
112
-
113
-        $output = $closure();
114
-
115
-        if ($echo) {
116
-            echo $output;
117
-        }
118
-
119
-        return $output;
120
-    }
121
-
122
-    /**
123
-     * Render a partial view (or section) for a given URI.
124
-     *
125
-     * @since 0.2.0
126
-     *
127
-     * @param string      $view    View identifier to create a view for.
128
-     * @param array       $context Optional. The context in which to render the view.
129
-     * @param string|null $type    Type of view to create.
130
-     *
131
-     * @return string Rendered HTML content.
132
-     * @throws FailedToProcessConfigException If the Config could not be processed.
133
-     * @throws FailedToInstantiateView If the View could not be instantiated.
134
-     */
135
-    public function section(string $view, array $context = null, $type = null): string
136
-    {
137
-        if (null === $context) {
138
-            $context = $this->_context_;
139
-        }
140
-
141
-        $this->initializeViewBuilder();
142
-        $viewObject = $this->_builder_->create($view, $type);
143
-
144
-        return $viewObject->render($context);
145
-    }
146
-
147
-    /**
148
-     * Get the entire array of contextual data.
149
-     *
150
-     * @since 0.4.0
151
-     *
152
-     * @return array Array of contextual data.
153
-     */
154
-    public function getContext(): array
155
-    {
156
-        return $this->_context_;
157
-    }
158
-
159
-    /**
160
-     * Associate a view builder with this view.
161
-     *
162
-     * @since 0.2.0
163
-     *
164
-     * @param ViewBuilder $builder
165
-     *
166
-     * @return View
167
-     */
168
-    public function setBuilder(ViewBuilder $builder): View
169
-    {
170
-        $this->_builder_ = $builder;
171
-
172
-        return $this;
173
-    }
174
-
175
-    /**
176
-     * Initialize the view builder associated with the view.
177
-     *
178
-     * @since 0.2.0
179
-     *
180
-     * @throws FailedToProcessConfigException If the Config could not be processed.
181
-     */
182
-    protected function initializeViewBuilder()
183
-    {
184
-        if (null === $this->_builder_) {
185
-            $this->_builder_ = Views::getViewBuilder();
186
-        }
187
-    }
188
-
189
-    /**
190
-     * Assimilate the context to make it available as properties.
191
-     *
192
-     * @since 0.2.0
193
-     *
194
-     * @param array $context Context to assimilate.
195
-     */
196
-    protected function assimilateContext(array $context = [])
197
-    {
198
-        $this->_context_ = $context;
199
-        foreach ($context as $key => $value) {
200
-            $this->$key = $value;
201
-        }
202
-    }
33
+	/**
34
+	 * URI of the view.
35
+	 *
36
+	 * The underscores are used to prevent accidental use of these properties from within the rendering closure.
37
+	 *
38
+	 * @since 0.1.0
39
+	 *
40
+	 * @var string
41
+	 */
42
+	protected $_uri_;
43
+
44
+	/**
45
+	 * Engine to use for the view.
46
+	 *
47
+	 * The underscores are used to prevent accidental use of these properties from within the rendering closure.
48
+	 *
49
+	 * @since 0.1.0
50
+	 *
51
+	 * @var Engine
52
+	 */
53
+	protected $_engine_;
54
+
55
+	/**
56
+	 * ViewBuilder instance.
57
+	 *
58
+	 * The underscores are used to prevent accidental use of these properties from within the rendering closure.
59
+	 *
60
+	 * @since 0.2.0
61
+	 *
62
+	 * @var ViewBuilder
63
+	 */
64
+	protected $_builder_;
65
+
66
+	/**
67
+	 * The context with which the view will be rendered.
68
+	 *
69
+	 * The underscores are used to prevent accidental use of these properties from within the rendering closure.
70
+	 *
71
+	 * @since 0.4.0
72
+	 *
73
+	 * @var array
74
+	 */
75
+	protected $_context_ = [];
76
+
77
+	/**
78
+	 * Instantiate an AbstractView object.
79
+	 *
80
+	 * @since 0.1.0
81
+	 *
82
+	 * @param string $uri    URI for the view.
83
+	 * @param Engine $engine Engine to use for the view.
84
+	 */
85
+	public function __construct(string $uri, Engine $engine)
86
+	{
87
+		$this->_uri_    = $uri;
88
+		$this->_engine_ = $engine;
89
+	}
90
+
91
+	/**
92
+	 * Render the view.
93
+	 *
94
+	 * @since 0.1.0
95
+	 *
96
+	 * @param array $context Optional. The context in which to render the view.
97
+	 * @param bool  $echo    Optional. Whether to echo the output immediately. Defaults to false.
98
+	 *
99
+	 * @return string Rendered HTML.
100
+	 * @throws FailedToProcessConfigException If the Config could not be processed.
101
+	 */
102
+	public function render(array $context = [], bool $echo = false): string
103
+	{
104
+		$this->initializeViewBuilder();
105
+		$this->assimilateContext($context);
106
+
107
+		$closure = Closure::bind(
108
+			$this->_engine_->getRenderCallback($this->_uri_, $context),
109
+			$this,
110
+			static::class
111
+		);
112
+
113
+		$output = $closure();
114
+
115
+		if ($echo) {
116
+			echo $output;
117
+		}
118
+
119
+		return $output;
120
+	}
121
+
122
+	/**
123
+	 * Render a partial view (or section) for a given URI.
124
+	 *
125
+	 * @since 0.2.0
126
+	 *
127
+	 * @param string      $view    View identifier to create a view for.
128
+	 * @param array       $context Optional. The context in which to render the view.
129
+	 * @param string|null $type    Type of view to create.
130
+	 *
131
+	 * @return string Rendered HTML content.
132
+	 * @throws FailedToProcessConfigException If the Config could not be processed.
133
+	 * @throws FailedToInstantiateView If the View could not be instantiated.
134
+	 */
135
+	public function section(string $view, array $context = null, $type = null): string
136
+	{
137
+		if (null === $context) {
138
+			$context = $this->_context_;
139
+		}
140
+
141
+		$this->initializeViewBuilder();
142
+		$viewObject = $this->_builder_->create($view, $type);
143
+
144
+		return $viewObject->render($context);
145
+	}
146
+
147
+	/**
148
+	 * Get the entire array of contextual data.
149
+	 *
150
+	 * @since 0.4.0
151
+	 *
152
+	 * @return array Array of contextual data.
153
+	 */
154
+	public function getContext(): array
155
+	{
156
+		return $this->_context_;
157
+	}
158
+
159
+	/**
160
+	 * Associate a view builder with this view.
161
+	 *
162
+	 * @since 0.2.0
163
+	 *
164
+	 * @param ViewBuilder $builder
165
+	 *
166
+	 * @return View
167
+	 */
168
+	public function setBuilder(ViewBuilder $builder): View
169
+	{
170
+		$this->_builder_ = $builder;
171
+
172
+		return $this;
173
+	}
174
+
175
+	/**
176
+	 * Initialize the view builder associated with the view.
177
+	 *
178
+	 * @since 0.2.0
179
+	 *
180
+	 * @throws FailedToProcessConfigException If the Config could not be processed.
181
+	 */
182
+	protected function initializeViewBuilder()
183
+	{
184
+		if (null === $this->_builder_) {
185
+			$this->_builder_ = Views::getViewBuilder();
186
+		}
187
+	}
188
+
189
+	/**
190
+	 * Assimilate the context to make it available as properties.
191
+	 *
192
+	 * @since 0.2.0
193
+	 *
194
+	 * @param array $context Context to assimilate.
195
+	 */
196
+	protected function assimilateContext(array $context = [])
197
+	{
198
+		$this->_context_ = $context;
199
+		foreach ($context as $key => $value) {
200
+			$this->$key = $value;
201
+		}
202
+	}
203 203
 }
Please login to merge, or discard this patch.
src/View/View/NullView.php 1 patch
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -26,74 +26,74 @@
 block discarded – undo
26 26
 class NullView implements View, NullFindable
27 27
 {
28 28
 
29
-    /**
30
-     * Check whether the Findable can handle an individual criterion.
31
-     *
32
-     * @since 0.1.0
33
-     *
34
-     * @param mixed $criterion Criterion to check.
35
-     *
36
-     * @return bool Whether the Findable can handle the criterion.
37
-     */
38
-    public function canHandle($criterion): bool
39
-    {
40
-        return true;
41
-    }
29
+	/**
30
+	 * Check whether the Findable can handle an individual criterion.
31
+	 *
32
+	 * @since 0.1.0
33
+	 *
34
+	 * @param mixed $criterion Criterion to check.
35
+	 *
36
+	 * @return bool Whether the Findable can handle the criterion.
37
+	 */
38
+	public function canHandle($criterion): bool
39
+	{
40
+		return true;
41
+	}
42 42
 
43
-    /**
44
-     * Render the view.
45
-     *
46
-     * @since 0.1.0
47
-     *
48
-     * @param array $context Optional. The context in which to render the view.
49
-     * @param bool  $echo    Optional. Whether to echo the output immediately. Defaults to false.
50
-     *
51
-     * @return string Rendered HTML.
52
-     */
53
-    public function render(array $context = [], bool $echo = false): string
54
-    {
55
-        return '';
56
-    }
43
+	/**
44
+	 * Render the view.
45
+	 *
46
+	 * @since 0.1.0
47
+	 *
48
+	 * @param array $context Optional. The context in which to render the view.
49
+	 * @param bool  $echo    Optional. Whether to echo the output immediately. Defaults to false.
50
+	 *
51
+	 * @return string Rendered HTML.
52
+	 */
53
+	public function render(array $context = [], bool $echo = false): string
54
+	{
55
+		return '';
56
+	}
57 57
 
58
-    /**
59
-     * Render a partial view (or section) for a given URI.
60
-     *
61
-     * @since 0.2.0
62
-     *
63
-     * @param string      $view    View identifier to create a view for.
64
-     * @param array       $context Optional. The context in which to render the view.
65
-     * @param string|null $type    Type of view to create.
66
-     *
67
-     * @return string Rendered HTML content.
68
-     */
69
-    public function section(string $view, array $context = [], $type = null): string
70
-    {
71
-        return '';
72
-    }
58
+	/**
59
+	 * Render a partial view (or section) for a given URI.
60
+	 *
61
+	 * @since 0.2.0
62
+	 *
63
+	 * @param string      $view    View identifier to create a view for.
64
+	 * @param array       $context Optional. The context in which to render the view.
65
+	 * @param string|null $type    Type of view to create.
66
+	 *
67
+	 * @return string Rendered HTML content.
68
+	 */
69
+	public function section(string $view, array $context = [], $type = null): string
70
+	{
71
+		return '';
72
+	}
73 73
 
74
-    /**
75
-     * Get the entire array of contextual data.
76
-     *
77
-     * @since 0.4.0
78
-     *
79
-     * @return array Array of contextual data.
80
-     */
81
-    public function getContext(): array
82
-    {
83
-        return [];
84
-    }
74
+	/**
75
+	 * Get the entire array of contextual data.
76
+	 *
77
+	 * @since 0.4.0
78
+	 *
79
+	 * @return array Array of contextual data.
80
+	 */
81
+	public function getContext(): array
82
+	{
83
+		return [];
84
+	}
85 85
 
86
-    /**
87
-     * Associate a view builder with this view.
88
-     *
89
-     * @since 0.2.0
90
-     *
91
-     * @param ViewBuilder $builder
92
-     *
93
-     * @return View
94
-     */
95
-    public function setBuilder(ViewBuilder $builder): View
96
-    {
97
-        return $this;
98
-    }
86
+	/**
87
+	 * Associate a view builder with this view.
88
+	 *
89
+	 * @since 0.2.0
90
+	 *
91
+	 * @param ViewBuilder $builder
92
+	 *
93
+	 * @return View
94
+	 */
95
+	public function setBuilder(ViewBuilder $builder): View
96
+	{
97
+		return $this;
98
+	}
99 99
 }
Please login to merge, or discard this patch.
src/View/Engine/BaseEngineFinder.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -25,40 +25,40 @@
 block discarded – undo
25 25
 class BaseEngineFinder extends AbstractFinder implements EngineFinder
26 26
 {
27 27
 
28
-    /**
29
-     * Find a result based on a specific criteria.
30
-     *
31
-     * @since 0.1.0
32
-     *
33
-     * @param array $criteria Criteria to search for.
34
-     *
35
-     * @return Engine Result of the search.
36
-     * @throws FailedToInstantiateFindable If the Findable could not be instantiated.
37
-     */
38
-    public function find(array $criteria): Engine
39
-    {
40
-        $this->initializeFindables();
28
+	/**
29
+	 * Find a result based on a specific criteria.
30
+	 *
31
+	 * @since 0.1.0
32
+	 *
33
+	 * @param array $criteria Criteria to search for.
34
+	 *
35
+	 * @return Engine Result of the search.
36
+	 * @throws FailedToInstantiateFindable If the Findable could not be instantiated.
37
+	 */
38
+	public function find(array $criteria): Engine
39
+	{
40
+		$this->initializeFindables();
41 41
 
42
-        foreach ($criteria as $entry) {
43
-            foreach ($this->findables as $engine) {
44
-                if ($engine->canHandle($entry)) {
45
-                    return $engine;
46
-                }
47
-            }
48
-        }
42
+		foreach ($criteria as $entry) {
43
+			foreach ($this->findables as $engine) {
44
+				if ($engine->canHandle($entry)) {
45
+					return $engine;
46
+				}
47
+			}
48
+		}
49 49
 
50
-        return $this->getNullObject();
51
-    }
50
+		return $this->getNullObject();
51
+	}
52 52
 
53
-    /**
54
-     * Get the config key for the Findables definitions.
55
-     *
56
-     * @since 0.1.0
57
-     *
58
-     * @return string Config key use to define the Findables.
59
-     */
60
-    protected function getFindablesConfigKey(): string
61
-    {
62
-        return 'Engines';
63
-    }
53
+	/**
54
+	 * Get the config key for the Findables definitions.
55
+	 *
56
+	 * @since 0.1.0
57
+	 *
58
+	 * @return string Config key use to define the Findables.
59
+	 */
60
+	protected function getFindablesConfigKey(): string
61
+	{
62
+		return 'Engines';
63
+	}
64 64
 }
Please login to merge, or discard this patch.