Passed
Pull Request — master (#29)
by Glynn
07:59
created
src/BladeOne_Engine.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare( strict_types=1 );
3
+declare(strict_types=1);
4 4
 
5 5
 /**
6 6
  * Implementation of BladeOne for the PinkCrab Perique frameworks Renderable interface
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 *
60 60
 	 * @param PinkCrab_BladeOne $blade
61 61
 	 */
62
-	final public function __construct( PinkCrab_BladeOne $blade ) {
62
+	final public function __construct(PinkCrab_BladeOne $blade) {
63 63
 		static::$blade = $blade;
64 64
 	}
65 65
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		?string $compiled_path = null,
77 77
 		int $mode = 0
78 78
 	): self {
79
-		return new static( new PinkCrab_BladeOne( $template_path, $compiled_path, $mode ) );
79
+		return new static(new PinkCrab_BladeOne($template_path, $compiled_path, $mode));
80 80
 	}
81 81
 
82 82
 	/**
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public function base_view_path(): string {
98 98
 		$paths = static::$blade->get_template_paths();
99
-		return ! empty( $paths ) ? reset( $paths ) : '';
99
+		return ! empty($paths) ? reset($paths) : '';
100 100
 	}
101 101
 
102 102
 	/**
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 	 * @param string $esc
106 106
 	 * @return self
107 107
 	 */
108
-	public function set_esc_function( string $esc ): self {
109
-		static::$blade->set_esc_function( $esc );
108
+	public function set_esc_function(string $esc): self {
109
+		static::$blade->set_esc_function($esc);
110 110
 		return $this;
111 111
 	}
112 112
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 * @param Component_Compiler $compiler
117 117
 	 * @return void
118 118
 	 */
119
-	public function set_component_compiler( Component_Compiler $compiler ): void {
119
+	public function set_component_compiler(Component_Compiler $compiler): void {
120 120
 		$this->component_compiler = $compiler;
121 121
 	}
122 122
 
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @return void|string
131 131
 	 */
132
-	public function render( string $view, iterable $data, bool $print_mode = true ) {
133
-		if ( $print_mode ) {
134
-			print static::$blade->run( $view, (array) $data ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
132
+	public function render(string $view, iterable $data, bool $print_mode = true) {
133
+		if ($print_mode) {
134
+			print static::$blade->run($view, (array) $data); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
135 135
 		} else {
136
-			return static::$blade->run( $view, (array) $data );
136
+			return static::$blade->run($view, (array) $data);
137 137
 		}
138 138
 	}
139 139
 
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
 	 *
146 146
 	 * @return string|void
147 147
 	 */
148
-	public function view_model( View_Model $view_model, bool $print_mode = true ) {
149
-		return $this->render( str_replace( array( '/', '\\' ), '.', $view_model->template() ), $view_model->data(), $print_mode );
148
+	public function view_model(View_Model $view_model, bool $print_mode = true) {
149
+		return $this->render(str_replace(array('/', '\\'), '.', $view_model->template()), $view_model->data(), $print_mode);
150 150
 	}
151 151
 
152 152
 		/**
@@ -157,16 +157,16 @@  discard block
 block discarded – undo
157 157
 	 *
158 158
 	 * @return string|void
159 159
 	 */
160
-	public function component( Component $component, bool $print_mode = true ) {
160
+	public function component(Component $component, bool $print_mode = true) {
161 161
 
162 162
 		// Throw exception of no compiler passed.
163
-		if ( null === $this->component_compiler ) {
164
-			throw new Exception( 'No component compiler passed to BladeOne' );
163
+		if (null === $this->component_compiler) {
164
+			throw new Exception('No component compiler passed to BladeOne');
165 165
 		}
166 166
 
167 167
 		// Compile the component.
168
-		$compiled = $this->component_compiler->compile( $component );
169
-		return $this->render( str_replace( array( '/', '\\' ), '.', $compiled->template() ), $compiled->data(), $print_mode );
168
+		$compiled = $this->component_compiler->compile($component);
169
+		return $this->render(str_replace(array('/', '\\'), '.', $compiled->template()), $compiled->data(), $print_mode);
170 170
 	}
171 171
 
172 172
 	/**
@@ -177,12 +177,12 @@  discard block
 block discarded – undo
177 177
 	 * @return mixed
178 178
 	 * @throws BadMethodCallException
179 179
 	 */
180
-	public function __call( string $method, array $args = array() ) {
181
-		if ( ! $this->is_method( $method ) ) {
182
-			throw new BadMethodCallException( esc_attr( "{$method} is not a valid method on the BladeOne instance." ) );
180
+	public function __call(string $method, array $args = array()) {
181
+		if ( ! $this->is_method($method)) {
182
+			throw new BadMethodCallException(esc_attr("{$method} is not a valid method on the BladeOne instance."));
183 183
 		}
184 184
 
185
-		return static::$blade->{$method}( ...$args );
185
+		return static::$blade->{$method}(...$args);
186 186
 	}
187 187
 
188 188
 	/**
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
 	 * @return mixed
194 194
 	 * @throws BadMethodCallException
195 195
 	 */
196
-	public static function __callStatic( string $method, array $args = array() ) {
197
-		if ( ! static::is_static_method( $method ) ) {
198
-			throw new BadMethodCallException( esc_attr( "{$method} is not a valid method on the BladeOne instance." ) );
196
+	public static function __callStatic(string $method, array $args = array()) {
197
+		if ( ! static::is_static_method($method)) {
198
+			throw new BadMethodCallException(esc_attr("{$method} is not a valid method on the BladeOne instance."));
199 199
 		}
200 200
 
201
-		return static::$blade::{$method}( ...$args );
201
+		return static::$blade::{$method}(...$args);
202 202
 	}
203 203
 
204 204
 	/**
@@ -207,15 +207,15 @@  discard block
 block discarded – undo
207 207
 	 * @param string $method
208 208
 	 * @return boolean
209 209
 	 */
210
-	protected function is_method( string $method ): bool {
211
-		$class_reflection = new ReflectionClass( static::$blade );
210
+	protected function is_method(string $method): bool {
211
+		$class_reflection = new ReflectionClass(static::$blade);
212 212
 
213 213
 		// Check method exists.
214
-		if ( ! $class_reflection->hasMethod( $method ) ) {
214
+		if ( ! $class_reflection->hasMethod($method)) {
215 215
 			return false;
216 216
 		}
217 217
 
218
-		$method_reflection = $class_reflection->getMethod( $method );
218
+		$method_reflection = $class_reflection->getMethod($method);
219 219
 
220 220
 		return $method_reflection->isPublic() && ! $method_reflection->isStatic();
221 221
 	}
@@ -226,15 +226,15 @@  discard block
 block discarded – undo
226 226
 	 * @param string $method
227 227
 	 * @return boolean
228 228
 	 */
229
-	protected static function is_static_method( string $method ): bool {
230
-		$class_reflection = new ReflectionClass( static::$blade );
229
+	protected static function is_static_method(string $method): bool {
230
+		$class_reflection = new ReflectionClass(static::$blade);
231 231
 
232 232
 		// Check method exists.
233
-		if ( ! $class_reflection->hasMethod( $method ) ) {
233
+		if ( ! $class_reflection->hasMethod($method)) {
234 234
 			return false;
235 235
 		}
236 236
 
237
-		$method_reflection = $class_reflection->getMethod( $method );
237
+		$method_reflection = $class_reflection->getMethod($method);
238 238
 		return $method_reflection->isPublic() && $method_reflection->isStatic();
239 239
 	}
240 240
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 	 * @param boolean $allow_pipe
245 245
 	 * @return self
246 246
 	 */
247
-	public function allow_pipe( bool $allow_pipe = true ): self {
247
+	public function allow_pipe(bool $allow_pipe = true): self {
248 248
 		static::$blade->pipeEnable = $allow_pipe; //phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
249 249
 		return $this;
250 250
 	}
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
 	 * @param callable $handler
257 257
 	 * @return self
258 258
 	 */
259
-	public function directive( string $name, callable $handler ): self {
260
-		static::$blade->directive( $name, $handler );
259
+	public function directive(string $name, callable $handler): self {
260
+		static::$blade->directive($name, $handler);
261 261
 		return $this;
262 262
 	}
263 263
 
@@ -268,8 +268,8 @@  discard block
 block discarded – undo
268 268
 	 * @param callable $handler
269 269
 	 * @return self
270 270
 	 */
271
-	public function directive_rt( $name, callable $handler ): self {
272
-		static::$blade->directiveRT( $name, $handler );
271
+	public function directive_rt($name, callable $handler): self {
272
+		static::$blade->directiveRT($name, $handler);
273 273
 		return $this;
274 274
 	}
275 275
 
@@ -280,8 +280,8 @@  discard block
 block discarded – undo
280 280
 	 * @param string|null $alias example "mynewop". If null then it uses the name of the template.
281 281
 	 * @return self
282 282
 	 */
283
-	public function add_include( $view, $alias = null ): self {
284
-		static::$blade->addInclude( $view, $alias );
283
+	public function add_include($view, $alias = null): self {
284
+		static::$blade->addInclude($view, $alias);
285 285
 		return $this;
286 286
 	}
287 287
 
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
 	 * @param string $class_with_namespace
293 293
 	 * @return self
294 294
 	 */
295
-	public function add_alias_classes( $alias_name, $class_with_namespace ): self {
296
-		static::$blade->addAliasClasses( $alias_name, $class_with_namespace );
295
+	public function add_alias_classes($alias_name, $class_with_namespace): self {
296
+		static::$blade->addAliasClasses($alias_name, $class_with_namespace);
297 297
 		return $this;
298 298
 	}
299 299
 
@@ -303,8 +303,8 @@  discard block
 block discarded – undo
303 303
 	 * @param integer $mode BladeOne::MODE_AUTO, BladeOne::MODE_DEBUG, BladeOne::MODE_FAST, BladeOne::MODE_SLOW
304 304
 	 * @return self
305 305
 	 */
306
-	public function set_mode( int $mode ): self {
307
-		static::$blade->setMode( $mode );
306
+	public function set_mode(int $mode): self {
307
+		static::$blade->setMode($mode);
308 308
 		return $this;
309 309
 	}
310 310
 
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
 	 * @param integer $comment_mode BladeOne::COMMENT_PHP, BladeOne::COMMENT_RAW, BladeOne::COMMENT_NONE
315 315
 	 * @return self
316 316
 	 */
317
-	public function set_comment_mode( int $comment_mode ): self {
318
-		static::$blade->setCommentMode( $comment_mode );
317
+	public function set_comment_mode(int $comment_mode): self {
318
+		static::$blade->setCommentMode($comment_mode);
319 319
 		return $this;
320 320
 	}
321 321
 
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
 	 * @param mixed                       $value
334 334
 	 * @return $this
335 335
 	 */
336
-	public function share( $var_name, $value = null ): self {
337
-		static::$blade->share( $var_name, $value );
336
+	public function share($var_name, $value = null): self {
337
+		static::$blade->share($var_name, $value);
338 338
 		return $this;
339 339
 	}
340 340
 
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
 	 * @param callable $resolver
345 345
 	 * @return $this
346 346
 	 */
347
-	public function set_inject_resolver( callable $resolver ): self {
348
-		static::$blade->setInjectResolver( $resolver );
347
+	public function set_inject_resolver(callable $resolver): self {
348
+		static::$blade->setInjectResolver($resolver);
349 349
 		return $this;
350 350
 	}
351 351
 
@@ -356,8 +356,8 @@  discard block
 block discarded – undo
356 356
 	 * @param string $file_extension Example: .prefix.ext
357 357
 	 * @return $this
358 358
 	 */
359
-	public function set_file_extension( string $file_extension ): self {
360
-		static::$blade->setFileExtension( $file_extension );
359
+	public function set_file_extension(string $file_extension): self {
360
+		static::$blade->setFileExtension($file_extension);
361 361
 		return $this;
362 362
 	}
363 363
 
@@ -368,8 +368,8 @@  discard block
 block discarded – undo
368 368
 	 * @param string $file_extension
369 369
 	 * @return $this
370 370
 	 */
371
-	public function set_compiled_extension( string $file_extension ): self {
372
-		static::$blade->setCompiledExtension( $file_extension );
371
+	public function set_compiled_extension(string $file_extension): self {
372
+		static::$blade->setCompiledExtension($file_extension);
373 373
 		return $this;
374 374
 	}
375 375
 }
Please login to merge, or discard this patch.
src/BladeOne.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare( strict_types=1 );
3
+declare(strict_types=1);
4 4
 
5 5
 /**
6 6
  * The BladeOne Module for Perique.
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 * @param string $template_path
58 58
 	 * @return self
59 59
 	 */
60
-	public function template_path( string $template_path ): self {
60
+	public function template_path(string $template_path): self {
61 61
 		$this->template_path = $template_path;
62 62
 		return $this;
63 63
 	}
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @param string $compiled_path
69 69
 	 * @return self
70 70
 	 */
71
-	public function compiled_path( string $compiled_path ): self {
71
+	public function compiled_path(string $compiled_path): self {
72 72
 		$this->compiled_path = $compiled_path;
73 73
 		return $this;
74 74
 	}
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 * @param integer $mode
80 80
 	 * @return self
81 81
 	 */
82
-	public function mode( int $mode ): self {
82
+	public function mode(int $mode): self {
83 83
 		$this->mode = $mode;
84 84
 		return $this;
85 85
 	}
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 * @param integer $comment_mode
91 91
 	 * @return self
92 92
 	 */
93
-	public function comment_mode( int $comment_mode ): self {
93
+	public function comment_mode(int $comment_mode): self {
94 94
 		$this->comment_mode = $comment_mode;
95 95
 		return $this;
96 96
 	}
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * @param \Closure(BladeOne_Engine):BladeOne_Engine $config
102 102
 	 * @return self
103 103
 	 */
104
-	public function config( \Closure $config ): self {
104
+	public function config(\Closure $config): self {
105 105
 		$this->config = $config;
106 106
 		return $this;
107 107
 	}
@@ -115,25 +115,25 @@  discard block
 block discarded – undo
115 115
 	 * @pram DI_Container $di_container
116 116
 	 * @return void
117 117
 	 */
118
-	public function pre_boot( App_Config $config, Hook_Loader $loader, DI_Container $di_container ): void { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed
118
+	public function pre_boot(App_Config $config, Hook_Loader $loader, DI_Container $di_container): void { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed
119 119
 		// @codeCoverageIgnoreStart
120
-		if ( ! function_exists( 'WP_Filesystem' ) ) {
120
+		if ( ! function_exists('WP_Filesystem')) {
121 121
 			// @phpstan-ignore-next-line
122
-			require_once ABSPATH . 'wp-admin/includes/file.php';
122
+			require_once ABSPATH.'wp-admin/includes/file.php';
123 123
 		}
124 124
 		// @codeCoverageIgnoreEnd
125 125
 		\WP_Filesystem();
126 126
 		global $wp_filesystem;
127 127
 
128 128
 		// If we dont have an instance of the WP_Filesystem, throw an exception.
129
-		if ( ! $wp_filesystem instanceof \WP_Filesystem_Base ) {
129
+		if ( ! $wp_filesystem instanceof \WP_Filesystem_Base) {
130 130
 			// @codeCoverageIgnoreStart
131
-			throw new \RuntimeException( 'Unable to create WP_Filesystem instance' );
131
+			throw new \RuntimeException('Unable to create WP_Filesystem instance');
132 132
 			// @codeCoverageIgnoreEnd
133 133
 		}
134 134
 
135 135
 		$wp_upload_dir = wp_upload_dir();
136
-		$compiled_path = $this->compiled_path ?? sprintf( '%1$s%2$sblade-cache', $wp_upload_dir['basedir'], \DIRECTORY_SEPARATOR ); // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed
136
+		$compiled_path = $this->compiled_path ?? sprintf('%1$s%2$sblade-cache', $wp_upload_dir['basedir'], \DIRECTORY_SEPARATOR); // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed
137 137
 		$instance      = new PinkCrab_BladeOne(
138 138
 			$this->template_path ?? $config->view_path(),
139 139
 			$compiled_path,
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
 			$this->comment_mode
142 142
 		);
143 143
 
144
-		$instance->setAuth( ...$this->get_auth_data() );
144
+		$instance->setAuth(...$this->get_auth_data());
145 145
 
146 146
 		// Create the compiled path if it does not exist.
147
-		if ( ! $wp_filesystem->exists( $compiled_path ) ) {
147
+		if ( ! $wp_filesystem->exists($compiled_path)) {
148 148
 
149 149
 			// Create the directory.
150
-			$wp_filesystem->mkdir( $compiled_path ); // phpcs:ignore WordPress.VIP.MkdirPermissions
150
+			$wp_filesystem->mkdir($compiled_path); // phpcs:ignore WordPress.VIP.MkdirPermissions
151 151
 		}
152 152
 
153 153
 		$di_container->addRule(
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 					$instance,
158 158
 				),
159 159
 				'call'            => array(
160
-					array( 'allow_pipe', array() ),
160
+					array('allow_pipe', array()),
161 161
 				),
162 162
 				'shared'          => true,
163 163
 			)
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 	private function get_auth_data(): array {
191 191
 
192 192
 		// @codeCoverageIgnoreStart
193
-		if ( ! function_exists( 'wp_get_current_user' ) ) {
193
+		if ( ! function_exists('wp_get_current_user')) {
194 194
 			// @phpstan-ignore-next-line
195
-			require_once ABSPATH . 'wp-includes/pluggable.php';
195
+			require_once ABSPATH.'wp-includes/pluggable.php';
196 196
 		}
197 197
 		// @codeCoverageIgnoreEnd
198 198
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 		return array(
201 201
 			0 !== $user->ID ? $user->user_login : '',
202 202
 			0 !== $user->ID ? $user->roles[0] : '',
203
-			0 !== $user->ID ? array_keys( array_filter( $user->allcaps ) ) : array(),
203
+			0 !== $user->ID ? array_keys(array_filter($user->allcaps)) : array(),
204 204
 		);
205 205
 	}
206 206
 
@@ -212,18 +212,18 @@  discard block
 block discarded – undo
212 212
 	 * @pram DI_Container $di_container
213 213
 	 * @return void
214 214
 	 */
215
-	public function pre_register( App_Config $config, Hook_Loader $loader, DI_Container $di_container ): void { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed
215
+	public function pre_register(App_Config $config, Hook_Loader $loader, DI_Container $di_container): void { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed
216 216
 
217
-		$provider = $di_container->create( BladeOne_Engine::class );
217
+		$provider = $di_container->create(BladeOne_Engine::class);
218 218
 
219 219
 		// If dont have an instance of BladeOne_Engine, return.
220
-		if ( ! $provider instanceof BladeOne_Engine ) {
221
-			throw new \RuntimeException( 'Unable to create BladeOne_Engine instance to configure instance' );
220
+		if ( ! $provider instanceof BladeOne_Engine) {
221
+			throw new \RuntimeException('Unable to create BladeOne_Engine instance to configure instance');
222 222
 		}
223 223
 
224 224
 		// Pass the config to the provider, if set.
225
-		if ( ! is_null( $this->config ) ) {
226
-			\call_user_func( $this->config, $provider );
225
+		if ( ! is_null($this->config)) {
226
+			\call_user_func($this->config, $provider);
227 227
 		}
228 228
 	}
229 229
 
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 *
240 240
 	 * @return void
241 241
 	 */
242
-	public function post_register( App_Config $config, Hook_Loader $loader, DI_Container $di_container ): void {} // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed
242
+	public function post_register(App_Config $config, Hook_Loader $loader, DI_Container $di_container): void {} // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed
243 243
 
244 244
 	/**
245 245
 	 * Unused method.
Please login to merge, or discard this patch.
src/PinkCrab_BladeOne.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare( strict_types=1 );
3
+declare(strict_types=1);
4 4
 
5 5
 /**
6 6
  * Wrapper for BladeOne with HTML enabled
@@ -55,19 +55,19 @@  discard block
 block discarded – undo
55 55
 	 * @param integer $mode          =[BladeOne::MODE_AUTO,BladeOne::MODE_DEBUG,BladeOne::MODE_FAST,BladeOne::MODE_SLOW][$i]
56 56
 	 * @param integer $comment_mode  =[BladeOne::COMMENT_PHP,BladeOne::COMMENT_RAW,BladeOne::COMMENT_NONE][$i]
57 57
 	 */
58
-	public function __construct( $template_path = null, $compiled_path = null, $mode = 0, $comment_mode = 0 ) {
59
-		parent::__construct( $template_path, $compiled_path, $mode, $comment_mode );
58
+	public function __construct($template_path = null, $compiled_path = null, $mode = 0, $comment_mode = 0) {
59
+		parent::__construct($template_path, $compiled_path, $mode, $comment_mode);
60 60
 
61 61
 		// Add the viewModel directive.
62
-		$this->directiveRT( 'viewModel', fn( $expression ) => $this->view_model( $expression, true ) );
62
+		$this->directiveRT('viewModel', fn($expression) => $this->view_model($expression, true));
63 63
 
64 64
 		// Add the component directive.
65
-		$this->directiveRT( 'viewComponent', fn( $expression ) => $this->component( $expression, true ) );
65
+		$this->directiveRT('viewComponent', fn($expression) => $this->component($expression, true));
66 66
 
67 67
 		// Add the WP_Nonce directive.
68 68
 		$this->directiveRT(
69 69
 			'nonce',
70
-			function ( string $action, ?string $field = null, bool $inc_referer = true ): void {
70
+			function(string $action, ?string $field = null, bool $inc_referer = true): void {
71 71
 				\wp_nonce_field(
72 72
 					$action,
73 73
 					$field ?? '_pcnonce',
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		);
79 79
 
80 80
 		// Allow other plugins to add their own directives.
81
-		\do_action( self::SETUP_CONFIG, $this );
81
+		\do_action(self::SETUP_CONFIG, $this);
82 82
 	}
83 83
 
84 84
 	/**
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
 	 * @param string $esc_function
103 103
 	 * @return void
104 104
 	 */
105
-	public function set_esc_function( string $esc_function ): void {
105
+	public function set_esc_function(string $esc_function): void {
106 106
 		// Throw exception if not a valid callable.
107
-		if ( ! \is_callable( $esc_function ) ) {
108
-			throw new \InvalidArgumentException( 'Invalid esc function provided.' );
107
+		if ( ! \is_callable($esc_function)) {
108
+			throw new \InvalidArgumentException('Invalid esc function provided.');
109 109
 		}
110 110
 
111 111
 		static::$esc_function = $esc_function;
112
-		$this->echoFormat     = sprintf( '\\%s(%%s)', $esc_function ); //phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
112
+		$this->echoFormat     = sprintf('\\%s(%%s)', $esc_function); //phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
113 113
 	}
114 114
 
115 115
 	/**
@@ -127,17 +127,17 @@  discard block
 block discarded – undo
127 127
 	 * @param integer|float|string|null|mixed[]|object $value
128 128
 	 * @return string
129 129
 	 */
130
-	public static function e( $value ): string {
131
-		if ( \is_null( $value ) ) {
130
+	public static function e($value): string {
131
+		if (\is_null($value)) {
132 132
 			return '';
133 133
 		}
134
-		if ( \is_array( $value ) || \is_object( $value ) ) {
135
-			return \call_user_func( static::$esc_function, \print_r( $value, true ) );//phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
134
+		if (\is_array($value) || \is_object($value)) {
135
+			return \call_user_func(static::$esc_function, \print_r($value, true)); //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
136 136
 		}
137
-		if ( \is_numeric( $value ) ) {
137
+		if (\is_numeric($value)) {
138 138
 			$value = (string) $value;
139 139
 		}
140
-		return \call_user_func( static::$esc_function, $value );
140
+		return \call_user_func(static::$esc_function, $value);
141 141
 	}
142 142
 
143 143
 	/**
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 *
149 149
 	 * @return string|void
150 150
 	 */
151
-	public function component( Component $component, bool $print_mode = true ) {
151
+	public function component(Component $component, bool $print_mode = true) {
152 152
 		/**
153 153
 		 * Creates a new instance of the view.
154 154
 		 *
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 		 */
157 157
 		$view = App::view();
158 158
 
159
-		return $view->component( $component, $print_mode );
159
+		return $view->component($component, $print_mode);
160 160
 	}
161 161
 
162 162
 	/**
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 *
168 168
 	 * @return string|void
169 169
 	 */
170
-	public function view_model( View_Model $view_model, bool $print_mode = true ) {
170
+	public function view_model(View_Model $view_model, bool $print_mode = true) {
171 171
 		/**
172 172
 		 * Creates a new instance of the view.
173 173
 		 *
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 		 */
176 176
 		$view = App::view();
177 177
 
178
-		return $view->view_model( $view_model, $print_mode );
178
+		return $view->view_model($view_model, $print_mode);
179 179
 	}
180 180
 
181 181
 	/**
@@ -184,13 +184,13 @@  discard block
 block discarded – undo
184 184
 	 * @param string $expression
185 185
 	 * @return string
186 186
 	 */
187
-	protected function compileAuth( $expression = '' ): string {
188
-		$role = $this->stripParentheses( $expression );
189
-		if ( $role === '' ) {
190
-			return $this->phpTag . 'if(!PinkCrab\FunctionConstructors\Strings\isBlank($this->currentUser)): ?>';
187
+	protected function compileAuth($expression = ''): string {
188
+		$role = $this->stripParentheses($expression);
189
+		if ($role === '') {
190
+			return $this->phpTag.'if(!PinkCrab\FunctionConstructors\Strings\isBlank($this->currentUser)): ?>';
191 191
 		}
192 192
 
193
-		return $this->phpTag . "if(!PinkCrab\FunctionConstructors\Strings\isBlank(\$this->currentUser) && \$this->currentRole==$role): ?>";
193
+		return $this->phpTag."if(!PinkCrab\FunctionConstructors\Strings\isBlank(\$this->currentUser) && \$this->currentRole==$role): ?>";
194 194
 	}
195 195
 
196 196
 	/**
@@ -199,13 +199,13 @@  discard block
 block discarded – undo
199 199
 	 * @param string $expression
200 200
 	 * @return string
201 201
 	 */
202
-	protected function compileElseAuth( $expression = '' ): string {
203
-		$role = $this->stripParentheses( $expression );
204
-		if ( $role === '' ) {
205
-			return $this->phpTag . 'else: ?>';
202
+	protected function compileElseAuth($expression = ''): string {
203
+		$role = $this->stripParentheses($expression);
204
+		if ($role === '') {
205
+			return $this->phpTag.'else: ?>';
206 206
 		}
207 207
 
208
-		return $this->phpTag . "elseif(!PinkCrab\FunctionConstructors\Strings\isBlank(\$this->currentUser) && \$this->currentRole==$role): ?>";
208
+		return $this->phpTag."elseif(!PinkCrab\FunctionConstructors\Strings\isBlank(\$this->currentUser) && \$this->currentRole==$role): ?>";
209 209
 	}
210 210
 
211 211
 	/**
@@ -214,18 +214,18 @@  discard block
 block discarded – undo
214 214
 	 * @param string|null $expression
215 215
 	 * @return string
216 216
 	 */
217
-	protected function compileGuest( $expression = null ): string {
217
+	protected function compileGuest($expression = null): string {
218 218
 
219
-		if ( $expression === null ) {
220
-			return $this->phpTag . 'if(PinkCrab\FunctionConstructors\Strings\isBlank($this->currentUser)): ?>';
219
+		if ($expression === null) {
220
+			return $this->phpTag.'if(PinkCrab\FunctionConstructors\Strings\isBlank($this->currentUser)): ?>';
221 221
 		}
222 222
 
223
-		$role = $this->stripParentheses( $expression );
224
-		if ( $role === '' ) {
225
-			return $this->phpTag . 'if(PinkCrab\FunctionConstructors\Strings\isBlank($this->currentUser)): ?>';
223
+		$role = $this->stripParentheses($expression);
224
+		if ($role === '') {
225
+			return $this->phpTag.'if(PinkCrab\FunctionConstructors\Strings\isBlank($this->currentUser)): ?>';
226 226
 		}
227 227
 
228
-		return $this->phpTag . "if(PinkCrab\FunctionConstructors\Strings\isBlank(\$this->currentUser) || \$this->currentRole!=$role): ?>";
228
+		return $this->phpTag."if(PinkCrab\FunctionConstructors\Strings\isBlank(\$this->currentUser) || \$this->currentRole!=$role): ?>";
229 229
 	}
230 230
 
231 231
 	/**
@@ -234,13 +234,13 @@  discard block
 block discarded – undo
234 234
 	 * @param string|null $expression
235 235
 	 * @return string
236 236
 	 */
237
-	protected function compileElseGuest( $expression ): string {
238
-		$role = $this->stripParentheses( $expression );
239
-		if ( $role === '' ) {
240
-			return $this->phpTag . 'else: ?>';
237
+	protected function compileElseGuest($expression): string {
238
+		$role = $this->stripParentheses($expression);
239
+		if ($role === '') {
240
+			return $this->phpTag.'else: ?>';
241 241
 		}
242 242
 
243
-		return $this->phpTag . "elseif(PinkCrab\FunctionConstructors\Strings\isBlank(\$this->currentUser) || \$this->currentRole!=$role): ?>";
243
+		return $this->phpTag."elseif(PinkCrab\FunctionConstructors\Strings\isBlank(\$this->currentUser) || \$this->currentRole!=$role): ?>";
244 244
 	}
245 245
 
246 246
 	/**
Please login to merge, or discard this patch.