Passed
Pull Request — master (#201)
by
unknown
06:35 queued 04:13
created
src/Services/View/Component/Component_Compiler.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 	/**
53 53
 	 * @param array<string, string> $component_aliases
54 54
 	 */
55
-	public function __construct( string $component_base_path = '', array $component_aliases = array() ) {
55
+	public function __construct(string $component_base_path = '', array $component_aliases = array()) {
56 56
 		$this->component_base_path = $component_base_path;
57
-		$this->component_aliases   = \apply_filters( Hooks::COMPONENT_ALIASES, $component_aliases );
57
+		$this->component_aliases   = \apply_filters(Hooks::COMPONENT_ALIASES, $component_aliases);
58 58
 	}
59 59
 
60 60
 	/**
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 	 * @param Component $component
64 64
 	 * @return View_Model
65 65
 	 */
66
-	public function compile( Component $component ): View_Model {
67
-		return new View_Model( $this->get_component_path( $component ), $component->get_variables() );
66
+	public function compile(Component $component): View_Model {
67
+		return new View_Model($this->get_component_path($component), $component->get_variables());
68 68
 	}
69 69
 
70 70
 	/**
@@ -73,34 +73,34 @@  discard block
 block discarded – undo
73 73
 	 * @param Component $component
74 74
 	 * @return string
75 75
 	 */
76
-	private function get_component_path( Component $component ): string {
76
+	private function get_component_path(Component $component): string {
77 77
 
78 78
 		// Check aliases.
79
-		$aliases = \apply_filters( Hooks::COMPONENT_ALIASES, $this->component_aliases );
79
+		$aliases = \apply_filters(Hooks::COMPONENT_ALIASES, $this->component_aliases);
80 80
 
81
-		if ( \array_key_exists( get_class( $component ), $this->component_aliases ) ) {
82
-			return esc_attr( $aliases[ get_class( $component ) ] );
81
+		if (\array_key_exists(get_class($component), $this->component_aliases)) {
82
+			return esc_attr($aliases[get_class($component)]);
83 83
 		}
84 84
 
85
-		$from_annotation = $this->get_annotation( 'view', $component );
85
+		$from_annotation = $this->get_annotation('view', $component);
86 86
 
87 87
 		// If it does have a path defined, use that.
88
-		if ( ! empty( $from_annotation ) ) {
89
-			return \trailingslashit( $this->component_base_path ) . $from_annotation;
88
+		if ( ! empty($from_annotation)) {
89
+			return \trailingslashit($this->component_base_path) . $from_annotation;
90 90
 		}
91 91
 
92 92
 		// If the component has a defined path
93
-		if ( $component->template() ) {
94
-			return \trailingslashit( $this->component_base_path ) . $component->template();
93
+		if ($component->template()) {
94
+			return \trailingslashit($this->component_base_path) . $component->template();
95 95
 		}
96 96
 
97 97
 		// Get path based on class name.
98
-		$reflect    = new \ReflectionClass( $component );
98
+		$reflect    = new \ReflectionClass($component);
99 99
 		$short_name = $reflect->getShortName();
100 100
 		// Add space between capitals, make lowercase and replace underscores with dashes.
101
-		$short_name = strtolower( preg_replace( '/(?<!^)[A-Z]/', '$0', $short_name ) ?? '' );
102
-		$short_name = str_replace( '_', '-', $short_name );
103
-		return \trailingslashit( $this->component_base_path ) . $short_name;
101
+		$short_name = strtolower(preg_replace('/(?<!^)[A-Z]/', '$0', $short_name) ?? '');
102
+		$short_name = str_replace('_', '-', $short_name);
103
+		return \trailingslashit($this->component_base_path) . $short_name;
104 104
 	}
105 105
 
106 106
 	/**
@@ -110,18 +110,18 @@  discard block
 block discarded – undo
110 110
 	 * @param Component $component
111 111
 	 * @return string|null
112 112
 	 */
113
-	private function get_annotation( string $annotation, Component $component ): ?string {
114
-		$reflect = new \ReflectionClass( $component );
113
+	private function get_annotation(string $annotation, Component $component): ?string {
114
+		$reflect = new \ReflectionClass($component);
115 115
 		$comment = $reflect->getDocComment();
116 116
 
117 117
 		// if no comment, return null.
118
-		if ( empty( $comment ) ) {
118
+		if (empty($comment)) {
119 119
 			return null;
120 120
 		}
121 121
 
122 122
 		// Check if the comment contains the annotation "@{$annotation}" using regex.
123 123
 		$pattern = "/@{$annotation}\s+(.*)/";
124
-		preg_match( $pattern, $comment, $matches );
124
+		preg_match($pattern, $comment, $matches);
125 125
 
126 126
 		return $matches[1] ?? null;
127 127
 	}
Please login to merge, or discard this patch.
src/Application/App_Config.php 1 patch
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
 	/**
96 96
 	 * @param array<string, mixed> $settings
97 97
 	 */
98
-	public function __construct( array $settings = array() ) {
99
-		$settings = $this->set_defaults( $settings );
100
-		$this->set_props( $settings );
98
+	public function __construct(array $settings = array()) {
99
+		$settings = $this->set_defaults($settings);
100
+		$this->set_props($settings);
101 101
 	}
102 102
 
103 103
 	/**
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 	 * @param array<string, mixed> $settings
107 107
 	 * @return array<string, mixed>
108 108
 	 */
109
-	private function set_defaults( array $settings ): array {
110
-		return array_replace_recursive( $this->settings_defaults(), $settings );
109
+	private function set_defaults(array $settings): array {
110
+		return array_replace_recursive($this->settings_defaults(), $settings);
111 111
 	}
112 112
 
113 113
 	/**
@@ -117,17 +117,17 @@  discard block
 block discarded – undo
117 117
 	 *
118 118
 	 * @return void
119 119
 	 */
120
-	private function set_props( array $settings ): void {
120
+	private function set_props(array $settings): void {
121 121
 		$this->paths['url']  = $settings['url'];
122 122
 		$this->paths['path'] = $settings['path'];
123
-		$this->namespaces    = $this->filter_key_value_pair( $settings['namespaces'] );
123
+		$this->namespaces    = $this->filter_key_value_pair($settings['namespaces']);
124 124
 		$this->plugin        = $settings['plugin'];
125 125
 		$this->additional    = $settings['additional'];
126
-		$this->db_tables     = $this->filter_key_value_pair( $settings['db_tables'] );
127
-		$this->post_types    = $this->filter_key_value_pair( $settings['post_types'] );
128
-		$this->taxonomies    = $this->filter_key_value_pair( $settings['taxonomies'] );
126
+		$this->db_tables     = $this->filter_key_value_pair($settings['db_tables']);
127
+		$this->post_types    = $this->filter_key_value_pair($settings['post_types']);
128
+		$this->taxonomies    = $this->filter_key_value_pair($settings['taxonomies']);
129 129
 
130
-		$this->set_meta( $settings['meta'] );
130
+		$this->set_meta($settings['meta']);
131 131
 	}
132 132
 
133 133
 	/**
@@ -138,14 +138,14 @@  discard block
 block discarded – undo
138 138
 	 *
139 139
 	 * @return array<string, mixed>|string|null
140 140
 	 */
141
-	public function path( ?string $path = null, ?string $default_value = null ) {
141
+	public function path(?string $path = null, ?string $default_value = null) {
142 142
 
143
-		if ( is_null( $path ) ) {
143
+		if (is_null($path)) {
144 144
 			return $this->paths['path'];
145 145
 		}
146 146
 
147
-		return \array_key_exists( $path, $this->paths['path'] )
148
-			? trailingslashit( $this->paths['path'][ $path ] )
147
+		return \array_key_exists($path, $this->paths['path'])
148
+			? trailingslashit($this->paths['path'][$path])
149 149
 			: $default_value;
150 150
 	}
151 151
 
@@ -157,14 +157,14 @@  discard block
 block discarded – undo
157 157
 	 *
158 158
 	 * @return array<string, mixed>|string|null
159 159
 	 */
160
-	public function url( ?string $url = null, ?string $default_value = null ) {
160
+	public function url(?string $url = null, ?string $default_value = null) {
161 161
 
162
-		if ( is_null( $url ) ) {
162
+		if (is_null($url)) {
163 163
 			return $this->paths['url'];
164 164
 		}
165 165
 
166
-		return \array_key_exists( $url, $this->paths['url'] )
167
-			? trailingslashit( $this->paths['url'][ $url ] )
166
+		return \array_key_exists($url, $this->paths['url'])
167
+			? trailingslashit($this->paths['url'][$url])
168 168
 			: $default_value;
169 169
 	}
170 170
 
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 	 *
195 195
 	 * @return string|null
196 196
 	 */
197
-	public function namespace( string $key, ?string $default_value = null ): ?string {
198
-		return array_key_exists( $key, $this->namespaces )
199
-			? $this->namespaces[ $key ] : $default_value;
197
+	public function namespace(string $key, ?string $default_value = null) : ?string {
198
+		return array_key_exists($key, $this->namespaces)
199
+			? $this->namespaces[$key] : $default_value;
200 200
 	}
201 201
 
202 202
 	/**
@@ -207,9 +207,9 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @return mixed
209 209
 	 */
210
-	public function additional( string $key, ?string $default_value = null ) {
211
-		return array_key_exists( $key, $this->additional )
212
-			? $this->additional[ $key ] : $default_value;
210
+	public function additional(string $key, ?string $default_value = null) {
211
+		return array_key_exists($key, $this->additional)
212
+			? $this->additional[$key] : $default_value;
213 213
 	}
214 214
 
215 215
 	/**
@@ -237,12 +237,12 @@  discard block
 block discarded – undo
237 237
 	 * @return string
238 238
 	 * @throws OutOfBoundsException
239 239
 	 */
240
-	public function post_types( string $key ) {
241
-		if ( ! array_key_exists( $key, $this->post_types ) ) {
242
-			throw new OutOfBoundsException( 'App Config :: "' . esc_html( $key ) . '" is not a defined post type' );
240
+	public function post_types(string $key) {
241
+		if ( ! array_key_exists($key, $this->post_types)) {
242
+			throw new OutOfBoundsException('App Config :: "' . esc_html($key) . '" is not a defined post type');
243 243
 		}
244 244
 
245
-		return $this->post_types[ $key ];
245
+		return $this->post_types[$key];
246 246
 	}
247 247
 
248 248
 	/**
@@ -253,17 +253,17 @@  discard block
 block discarded – undo
253 253
 	 * @return string
254 254
 	 * @throws OutOfBoundsException
255 255
 	 */
256
-	public function meta( string $key, string $type = self::POST_META ): string {
256
+	public function meta(string $key, string $type = self::POST_META): string {
257 257
 		// Check meta type.
258
-		if ( ! array_key_exists( $type, $this->meta ) ) {
259
-			throw new OutOfBoundsException( 'App Config :: "' . esc_html( $type ) . '" is not a valid meta type and cant be fetched' );
258
+		if ( ! array_key_exists($type, $this->meta)) {
259
+			throw new OutOfBoundsException('App Config :: "' . esc_html($type) . '" is not a valid meta type and cant be fetched');
260 260
 		}
261 261
 		// Check key.
262
-		if ( ! array_key_exists( $key, $this->meta[ $type ] ) ) {
263
-			throw new OutOfBoundsException( 'App Config :: "' . esc_html( $key ) . '" is not a defined ' . esc_html( $type ) . 'meta key' );
262
+		if ( ! array_key_exists($key, $this->meta[$type])) {
263
+			throw new OutOfBoundsException('App Config :: "' . esc_html($key) . '" is not a defined ' . esc_html($type) . 'meta key');
264 264
 		}
265 265
 
266
-		return $this->meta[ $type ][ $key ];
266
+		return $this->meta[$type][$key];
267 267
 	}
268 268
 
269 269
 	/**
@@ -273,8 +273,8 @@  discard block
 block discarded – undo
273 273
 	 * @param string $key
274 274
 	 * @return string
275 275
 	 */
276
-	public function post_meta( string $key ): string {
277
-		return $this->meta( $key, self::POST_META );
276
+	public function post_meta(string $key): string {
277
+		return $this->meta($key, self::POST_META);
278 278
 	}
279 279
 
280 280
 	/**
@@ -284,8 +284,8 @@  discard block
 block discarded – undo
284 284
 	 * @param string $key
285 285
 	 * @return string
286 286
 	 */
287
-	public function user_meta( string $key ): string {
288
-		return $this->meta( $key, self::USER_META );
287
+	public function user_meta(string $key): string {
288
+		return $this->meta($key, self::USER_META);
289 289
 	}
290 290
 
291 291
 	/**
@@ -295,8 +295,8 @@  discard block
 block discarded – undo
295 295
 	 * @param string $key
296 296
 	 * @return string
297 297
 	 */
298
-	public function term_meta( string $key ): string {
299
-		return $this->meta( $key, self::TERM_META );
298
+	public function term_meta(string $key): string {
299
+		return $this->meta($key, self::TERM_META);
300 300
 	}
301 301
 
302 302
 	/**
@@ -305,15 +305,15 @@  discard block
 block discarded – undo
305 305
 	 * @param array<string, array<string,string>> $meta
306 306
 	 * @return void
307 307
 	 */
308
-	public function set_meta( array $meta ): void {
309
-		$valid_meta_types = array( self::POST_META, self::USER_META, self::TERM_META );
310
-		foreach ( $meta as $meta_type => $pairs ) {
311
-			if ( ! in_array( $meta_type, $valid_meta_types, true ) ) {
312
-				throw new OutOfBoundsException( 'App Config :: "' . esc_html( $meta_type ) . '" is not a valid meta type and cant be defined' );
308
+	public function set_meta(array $meta): void {
309
+		$valid_meta_types = array(self::POST_META, self::USER_META, self::TERM_META);
310
+		foreach ($meta as $meta_type => $pairs) {
311
+			if ( ! in_array($meta_type, $valid_meta_types, true)) {
312
+				throw new OutOfBoundsException('App Config :: "' . esc_html($meta_type) . '" is not a valid meta type and cant be defined');
313 313
 			}
314 314
 
315 315
 			// Set all pairs which have both valid key and values.
316
-			$this->meta[ $meta_type ] = $this->filter_key_value_pair( $pairs );
316
+			$this->meta[$meta_type] = $this->filter_key_value_pair($pairs);
317 317
 		}
318 318
 	}
319 319
 
@@ -324,12 +324,12 @@  discard block
 block discarded – undo
324 324
 	 * @return string
325 325
 	 * @throws OutOfBoundsException
326 326
 	 */
327
-	public function taxonomies( string $key ): string {
328
-		if ( ! array_key_exists( $key, $this->taxonomies ) ) {
329
-			throw new OutOfBoundsException( 'App Config :: "' . esc_html( $key ) . '" is not a defined taxonomy' );
327
+	public function taxonomies(string $key): string {
328
+		if ( ! array_key_exists($key, $this->taxonomies)) {
329
+			throw new OutOfBoundsException('App Config :: "' . esc_html($key) . '" is not a defined taxonomy');
330 330
 		}
331 331
 
332
-		return $this->taxonomies[ $key ];
332
+		return $this->taxonomies[$key];
333 333
 	}
334 334
 
335 335
 
@@ -340,11 +340,11 @@  discard block
 block discarded – undo
340 340
 	 * @return string
341 341
 	 * @throws OutOfBoundsException
342 342
 	 */
343
-	public function db_tables( string $name ): string {
344
-		if ( ! array_key_exists( $name, $this->db_tables ) ) {
345
-			throw new OutOfBoundsException( 'App Config :: "' . esc_html( $name ) . '" is not a defined DB table' );
343
+	public function db_tables(string $name): string {
344
+		if ( ! array_key_exists($name, $this->db_tables)) {
345
+			throw new OutOfBoundsException('App Config :: "' . esc_html($name) . '" is not a defined DB table');
346 346
 		}
347
-		return $this->db_tables[ $name ];
347
+		return $this->db_tables[$name];
348 348
 	}
349 349
 
350 350
 	/**
@@ -353,8 +353,8 @@  discard block
 block discarded – undo
353 353
 	 * @param string $name
354 354
 	 * @return mixed
355 355
 	 */
356
-	public function __get( $name ) {
357
-		return $this->additional( $name );
356
+	public function __get($name) {
357
+		return $this->additional($name);
358 358
 	}
359 359
 
360 360
 	/**
@@ -363,11 +363,11 @@  discard block
 block discarded – undo
363 363
 	 * @return array<string, mixed>
364 364
 	 */
365 365
 	private function settings_defaults(): array {
366
-		$base_path  = \dirname( __DIR__, 2 );
366
+		$base_path  = \dirname(__DIR__, 2);
367 367
 		$wp_uploads = \wp_upload_dir();
368 368
 
369
-		$base_path = App_Config_Path_Helper::normalise_path( $base_path );
370
-		$view_path = App_Config_Path_Helper::assume_view_path( $base_path );
369
+		$base_path = App_Config_Path_Helper::normalise_path($base_path);
370
+		$view_path = App_Config_Path_Helper::assume_view_path($base_path);
371 371
 
372 372
 		global $wpdb;
373 373
 
@@ -384,9 +384,9 @@  discard block
 block discarded – undo
384 384
 				'upload_current' => $wp_uploads['path'],
385 385
 			),
386 386
 			'url'        => array(
387
-				'plugin'         => App_Config_Path_Helper::assume_base_url( $base_path ),
388
-				'view'           => App_Config_Path_Helper::assume_view_url( $base_path, $view_path ),
389
-				'assets'         => App_Config_Path_Helper::assume_base_url( $base_path ) . '/assets',
387
+				'plugin'         => App_Config_Path_Helper::assume_base_url($base_path),
388
+				'view'           => App_Config_Path_Helper::assume_view_url($base_path, $view_path),
389
+				'assets'         => App_Config_Path_Helper::assume_base_url($base_path) . '/assets',
390 390
 				'upload_root'    => $wp_uploads['baseurl'],
391 391
 				'upload_current' => $wp_uploads['url'],
392 392
 			),
@@ -408,17 +408,17 @@  discard block
 block discarded – undo
408 408
 	 * @param array<int|string, mixed> $pairs
409 409
 	 * @return array<string, string>
410 410
 	 */
411
-	private function filter_key_value_pair( array $pairs ): array {
411
+	private function filter_key_value_pair(array $pairs): array {
412 412
 		/**
413 413
 		 * @var array<string, string> (as per filter function)
414 414
 		 */
415 415
 		return array_filter(
416 416
 			$pairs,
417
-			function ( $value, $key ): bool {
418
-				return is_string( $value )
419
-				&& \strlen( $value ) > 0
420
-				&& is_string( $key )
421
-				&& \strlen( $key ) > 0;
417
+			function($value, $key): bool {
418
+				return is_string($value)
419
+				&& \strlen($value) > 0
420
+				&& is_string($key)
421
+				&& \strlen($key) > 0;
422 422
 			},
423 423
 			ARRAY_FILTER_USE_BOTH
424 424
 		);
@@ -449,8 +449,8 @@  discard block
 block discarded – undo
449 449
 	 * @return string
450 450
 	 */
451 451
 	public function asset_path(): string {
452
-		$paths = $this->path( 'assets' );
453
-		return is_string( $paths ) ? $paths : '';
452
+		$paths = $this->path('assets');
453
+		return is_string($paths) ? $paths : '';
454 454
 	}
455 455
 
456 456
 	/**
@@ -459,8 +459,8 @@  discard block
 block discarded – undo
459 459
 	 * @return string
460 460
 	 */
461 461
 	public function view_path(): string {
462
-		$paths = $this->path( 'view' );
463
-		return is_string( $paths ) ? $paths : '';
462
+		$paths = $this->path('view');
463
+		return is_string($paths) ? $paths : '';
464 464
 	}
465 465
 
466 466
 	/**
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
 	 * @return string
470 470
 	 */
471 471
 	public function plugin_path(): string {
472
-		$paths = $this->path( 'plugin' );
473
-		return is_string( $paths ) ? $paths : '';
472
+		$paths = $this->path('plugin');
473
+		return is_string($paths) ? $paths : '';
474 474
 	}
475 475
 
476 476
 	/**
@@ -479,8 +479,8 @@  discard block
 block discarded – undo
479 479
 	 * @return string
480 480
 	 */
481 481
 	public function asset_url(): string {
482
-		$url = $this->url( 'assets' );
483
-		return is_string( $url ) ? $url : '';
482
+		$url = $this->url('assets');
483
+		return is_string($url) ? $url : '';
484 484
 	}
485 485
 
486 486
 	/**
@@ -489,8 +489,8 @@  discard block
 block discarded – undo
489 489
 	 * @return string
490 490
 	 */
491 491
 	public function view_url(): string {
492
-		$url = $this->url( 'view' );
493
-		return is_string( $url ) ? $url : '';
492
+		$url = $this->url('view');
493
+		return is_string($url) ? $url : '';
494 494
 	}
495 495
 
496 496
 	/**
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 	 * @return string
500 500
 	 */
501 501
 	public function plugin_url(): string {
502
-		$url = $this->url( 'plugin' );
503
-		return is_string( $url ) ? $url : '';
502
+		$url = $this->url('plugin');
503
+		return is_string($url) ? $url : '';
504 504
 	}
505 505
 }
Please login to merge, or discard this patch.
src/Services/Dice/PinkCrab_Dice.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 *
44 44
 	 * @param Dice $dice
45 45
 	 */
46
-	public function __construct( Dice $dice ) {
46
+	public function __construct(Dice $dice) {
47 47
 		$this->dice = $dice;
48 48
 	}
49 49
 
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 	 * @param Dice $dice
54 54
 	 * @return self
55 55
 	 */
56
-	public static function withDice( Dice $dice ): self { // phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
57
-		return new PinkCrab_Dice( $dice );
56
+	public static function withDice(Dice $dice): self { // phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
57
+		return new PinkCrab_Dice($dice);
58 58
 	}
59 59
 
60 60
 	/**
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 	 * @param string $id Class name (fully namespaced.)
65 65
 	 * @return object|null
66 66
 	 */
67
-	public function get( string $id ): ?object {
68
-		if ( ! $this->has( $id ) ) {
69
-			throw new DI_Container_Exception( esc_html( "{$id} not defined in container" ), 1 );
67
+	public function get(string $id): ?object {
68
+		if ( ! $this->has($id)) {
69
+			throw new DI_Container_Exception(esc_html("{$id} not defined in container"), 1);
70 70
 		}
71
-		return $this->create( $id );
71
+		return $this->create($id);
72 72
 	}
73 73
 
74 74
 	/**
@@ -78,21 +78,21 @@  discard block
 block discarded – undo
78 78
 	 * @param string $id Class name (fully namespaced.)
79 79
 	 * @return boolean
80 80
 	 */
81
-	public function has( string $id ): bool {
82
-		$from_dice = $this->dice->getRule( $id );
81
+	public function has(string $id): bool {
82
+		$from_dice = $this->dice->getRule($id);
83 83
 		// If set in global rules.
84
-		if ( array_key_exists( 'substitutions', $from_dice )
85
-		&& array_key_exists( $id, $from_dice['substitutions'] ) ) {
84
+		if (array_key_exists('substitutions', $from_dice)
85
+		&& array_key_exists($id, $from_dice['substitutions'])) {
86 86
 			return true;
87 87
 		}
88 88
 
89 89
 		// If set with a replacement instance.
90
-		if ( array_key_exists( 'instanceOf', $from_dice ) ) {
90
+		if (array_key_exists('instanceOf', $from_dice)) {
91 91
 			return true;
92 92
 		}
93 93
 
94 94
 		// Checks if the class exists
95
-		return class_exists( $id );
95
+		return class_exists($id);
96 96
 	}
97 97
 
98 98
 	/**
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 	 * @param array<string, string|object|mixed[]> $rule
103 103
 	 * @return PinkCrab_Dice
104 104
 	 */
105
-	public function addRule( string $name, array $rule ): DI_Container { // phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
106
-		$this->dice = $this->dice->addRule( $name, $rule );
105
+	public function addRule(string $name, array $rule): DI_Container { // phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
106
+		$this->dice = $this->dice->addRule($name, $rule);
107 107
 		return $this;
108 108
 	}
109 109
 
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
 	 * @param array<string, mixed[]> $rules
114 114
 	 * @return PinkCrab_Dice
115 115
 	 */
116
-	public function addRules( array $rules ): DI_Container { // phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
117
-		$this->dice = $this->dice->addRules( apply_filters( Hooks::APP_INIT_SET_DI_RULES, $rules ) );
116
+	public function addRules(array $rules): DI_Container { // phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
117
+		$this->dice = $this->dice->addRules(apply_filters(Hooks::APP_INIT_SET_DI_RULES, $rules));
118 118
 		return $this;
119 119
 	}
120 120
 
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
 	 * @param array<mixed> $args
126 126
 	 * @return object|null
127 127
 	 */
128
-	public function create( string $name, array $args = array() ): ?object {
129
-		return $this->dice->create( $name, $args );
128
+	public function create(string $name, array $args = array()): ?object {
129
+		return $this->dice->create($name, $args);
130 130
 	}
131 131
 
132 132
 	/**
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 * @param string $name
136 136
 	 * @return array<mixed>
137 137
 	 */
138
-	public function getRule( string $name ): ?array {
139
-		return $this->dice->getRule( $name );
138
+	public function getRule(string $name): ?array {
139
+		return $this->dice->getRule($name);
140 140
 	}
141 141
 }
Please login to merge, or discard this patch.
src/Services/View/PHP_Engine.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @param string $base_view_path
55 55
 	 */
56
-	public function __construct( string $base_view_path ) {
57
-		$this->base_view_path = $this->verify_view_path( $base_view_path );
56
+	public function __construct(string $base_view_path) {
57
+		$this->base_view_path = $this->verify_view_path($base_view_path);
58 58
 	}
59 59
 
60 60
 	/**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @param Component_Compiler $compiler
64 64
 	 * @return void
65 65
 	 */
66
-	public function set_component_compiler( Component_Compiler $compiler ): void {
66
+	public function set_component_compiler(Component_Compiler $compiler): void {
67 67
 		$this->component_compiler = $compiler;
68 68
 	}
69 69
 
@@ -75,13 +75,13 @@  discard block
 block discarded – undo
75 75
 	 * @param boolean                 $print
76 76
 	 * @return string|null
77 77
 	 */
78
-	public function render( string $view, iterable $data, bool $print = true ): ?string {
79
-		$view = $this->resolve_file_path( $view );
80
-		if ( $print ) {
81
-			print( $this->render_buffer( $view, $data ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
78
+	public function render(string $view, iterable $data, bool $print = true): ?string {
79
+		$view = $this->resolve_file_path($view);
80
+		if ($print) {
81
+			print($this->render_buffer($view, $data)); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
82 82
 			return null;
83 83
 		} else {
84
-			return $this->render_buffer( $view, $data );
84
+			return $this->render_buffer($view, $data);
85 85
 		}
86 86
 	}
87 87
 
@@ -91,26 +91,26 @@  discard block
 block discarded – undo
91 91
 	 * @param Component $component
92 92
 	 * @return string
93 93
 	 */
94
-	public function component( Component $component, bool $print = true ): ?string {
94
+	public function component(Component $component, bool $print = true): ?string {
95 95
 
96 96
 		// Throw exception of no compiler passed.
97
-		if ( ! Object_Helper::is_a( $this->component_compiler, Component_Compiler::class ) ) {
98
-			throw new Exception( 'No component compiler passed to PHP_Engine' );
97
+		if ( ! Object_Helper::is_a($this->component_compiler, Component_Compiler::class)) {
98
+			throw new Exception('No component compiler passed to PHP_Engine');
99 99
 		}
100 100
 
101 101
 		// Compile the component.
102
-		$compiled = $this->component_compiler->compile( $component ); // @phpstan-ignore-line, checked above.
102
+		$compiled = $this->component_compiler->compile($component); // @phpstan-ignore-line, checked above.
103 103
 		$template = $compiled->template();
104 104
 
105
-		$view = file_exists( $template )
105
+		$view = file_exists($template)
106 106
 			? $template
107
-			: sprintf( '%s%s%s.php', $this->base_view_path, \DIRECTORY_SEPARATOR, trim( $this->maybe_resolve_dot_notation( $template ) ) );
107
+			: sprintf('%s%s%s.php', $this->base_view_path, \DIRECTORY_SEPARATOR, trim($this->maybe_resolve_dot_notation($template)));
108 108
 
109
-		if ( $print ) {
110
-			print( $this->render_buffer( $view, $compiled->data() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
109
+		if ($print) {
110
+			print($this->render_buffer($view, $compiled->data())); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
111 111
 			return null;
112 112
 		} else {
113
-			return $this->render_buffer( $view, $compiled->data() );
113
+			return $this->render_buffer($view, $compiled->data());
114 114
 		}
115 115
 	}
116 116
 
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
 	 * @param View_Model $view_model
121 121
 	 * @return string|null
122 122
 	 */
123
-	public function view_model( View_Model $view_model, bool $print = true ): ?string {
124
-		return $this->render( $view_model->template(), $view_model->data(), $print );
123
+	public function view_model(View_Model $view_model, bool $print = true): ?string {
124
+		return $this->render($view_model->template(), $view_model->data(), $print);
125 125
 	}
126 126
 
127 127
 	/**
@@ -132,12 +132,12 @@  discard block
 block discarded – undo
132 132
 	 * @param boolean                 $print
133 133
 	 * @return string|null
134 134
 	 */
135
-	public function partial( string $view, iterable $data = array(), bool $print = true ): ?string {
136
-		if ( $print ) {
137
-			$this->render( $view, $data, $print );
135
+	public function partial(string $view, iterable $data = array(), bool $print = true): ?string {
136
+		if ($print) {
137
+			$this->render($view, $data, $print);
138 138
 			return null;
139 139
 		} else {
140
-			return $this->render( $view, $data, $print );
140
+			return $this->render($view, $data, $print);
141 141
 		}
142 142
 	}
143 143
 
@@ -149,27 +149,27 @@  discard block
 block discarded – undo
149 149
 	 * @return string
150 150
 	 * @throws Exception
151 151
 	 */
152
-	private function render_buffer( string $view, iterable $__data ): string {
152
+	private function render_buffer(string $view, iterable $__data): string {
153 153
 
154
-		if ( ! file_exists( $view ) ) {
155
-			throw new Exception( esc_html( "{$view} doesn't exist" ) );
154
+		if ( ! file_exists($view)) {
155
+			throw new Exception(esc_html("{$view} doesn't exist"));
156 156
 		}
157 157
 
158 158
 		$output = '';
159 159
 		ob_start();
160 160
 
161 161
 		// Set all the data values a parameters.
162
-		foreach ( $__data as $__key => $__value ) {
163
-			if ( is_string( $__key ) ) {
164
-				${\wp_strip_all_tags( $__key )} = $__value;
162
+		foreach ($__data as $__key => $__value) {
163
+			if (is_string($__key)) {
164
+				${\wp_strip_all_tags($__key)} = $__value;
165 165
 			}
166 166
 
167 167
 			// Unset the key and value.
168
-			unset( $__key, $__value );
168
+			unset($__key, $__value);
169 169
 		}
170 170
 
171 171
 		// Unset the data.
172
-		unset( $__data );
172
+		unset($__data);
173 173
 
174 174
 		include $view;
175 175
 		$output = ob_get_contents();
@@ -183,12 +183,12 @@  discard block
 block discarded – undo
183 183
 	 * @param string $filename
184 184
 	 * @return string
185 185
 	 */
186
-	private function resolve_file_path( string $filename ): string {
187
-		$filename = $this->maybe_resolve_dot_notation( $filename );
186
+	private function resolve_file_path(string $filename): string {
187
+		$filename = $this->maybe_resolve_dot_notation($filename);
188 188
 		return sprintf(
189 189
 			'%s%s.php',
190 190
 			$this->base_view_path,
191
-			trim( $filename )
191
+			trim($filename)
192 192
 		);
193 193
 	}
194 194
 
@@ -198,13 +198,13 @@  discard block
 block discarded – undo
198 198
 	 * @param string $filename
199 199
 	 * @return string
200 200
 	 */
201
-	private function maybe_resolve_dot_notation( string $filename ): string {
202
-		if ( endsWith( '.php' )( $filename ) ) {
203
-			$filename = substr( $filename, 0, -4 );
201
+	private function maybe_resolve_dot_notation(string $filename): string {
202
+		if (endsWith('.php')($filename)) {
203
+			$filename = substr($filename, 0, -4);
204 204
 		}
205 205
 
206
-		$parts    = explode( '.', $filename );
207
-		$filename = implode( DIRECTORY_SEPARATOR, $parts );
206
+		$parts    = explode('.', $filename);
207
+		$filename = implode(DIRECTORY_SEPARATOR, $parts);
208 208
 
209 209
 		return $filename;
210 210
 	}
@@ -216,12 +216,12 @@  discard block
 block discarded – undo
216 216
 	 * @return string
217 217
 	 * @throws Exception
218 218
 	 */
219
-	private function verify_view_path( string $path ): string {
220
-		$path = $this->maybe_resolve_dot_notation( $path );
221
-		$path = rtrim( $path, '/' ) . '/';
219
+	private function verify_view_path(string $path): string {
220
+		$path = $this->maybe_resolve_dot_notation($path);
221
+		$path = rtrim($path, '/') . '/';
222 222
 
223
-		if ( ! \is_dir( $path ) ) {
224
-			throw new Exception( esc_html( "{$path} doesn't exist and cant be used as the base view path." ) );
223
+		if ( ! \is_dir($path)) {
224
+			throw new Exception(esc_html("{$path} doesn't exist and cant be used as the base view path."));
225 225
 		}
226 226
 
227 227
 		return $path;
Please login to merge, or discard this patch.
src/Services/Registration/Module_Manager.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 *
68 68
 	 * @param DI_Container $di_container
69 69
 	 */
70
-	public function __construct( DI_Container $di_container, Registration_Service $registration_service ) {
70
+	public function __construct(DI_Container $di_container, Registration_Service $registration_service) {
71 71
 		$this->di_container = $di_container;
72 72
 
73 73
 		// Create the registration service.
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	 * @param callable(Module, ?Registration_Middleware):Module $config
83 83
 	 * @return void
84 84
 	 */
85
-	public function push_module( string $module_name, ?callable $config = null ): void {
86
-		$this->modules[] = array( $module_name, $config );
85
+	public function push_module(string $module_name, ?callable $config = null): void {
86
+		$this->modules[] = array($module_name, $config);
87 87
 	}
88 88
 
89 89
 	/**
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @param class-string $class_string The class to register.
93 93
 	 */
94
-	public function register_class( string $class_string ): void {
95
-		$this->registration_service->push_class( $class_string );
94
+	public function register_class(string $class_string): void {
95
+		$this->registration_service->push_class($class_string);
96 96
 	}
97 97
 
98 98
 	/**
@@ -104,26 +104,26 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	public function register_modules(): void {
106 106
 		// Allow for additional apps to hook into the Module Manager.
107
-		do_action( Hooks::MODULE_MANAGER, $this );
107
+		do_action(Hooks::MODULE_MANAGER, $this);
108 108
 
109
-		foreach ( $this->modules as list($module_name, $config) ) {
109
+		foreach ($this->modules as list($module_name, $config)) {
110 110
 			// Create the instance.
111
-			$module = $this->create_module( $module_name );
111
+			$module = $this->create_module($module_name);
112 112
 
113 113
 			// Create the middleware.
114
-			$middleware = $this->create_middleware( $module );
114
+			$middleware = $this->create_middleware($module);
115 115
 
116 116
 			// If a config is provided, call it.
117
-			if ( ! is_null( $config ) ) {
118
-				$module = $config( $module, $middleware );
117
+			if ( ! is_null($config)) {
118
+				$module = $config($module, $middleware);
119 119
 			}
120 120
 
121 121
 			// Add to the modules and register all hooks.
122
-			$this->register_hooks( $module );
122
+			$this->register_hooks($module);
123 123
 
124 124
 			// Add to the middleware, if provided.
125
-			if ( ! is_null( $middleware ) ) {
126
-				$this->registration_service->push_middleware( $middleware );
125
+			if ( ! is_null($middleware)) {
126
+				$this->registration_service->push_middleware($middleware);
127 127
 			}
128 128
 		}
129 129
 	}
@@ -134,14 +134,14 @@  discard block
 block discarded – undo
134 134
 	 * @param class-string<Module> $module
135 135
 	 * @return Module
136 136
 	 */
137
-	private function create_module( string $module ): Module {
138
-		$instance = $this->di_container->create( $module );
137
+	private function create_module(string $module): Module {
138
+		$instance = $this->di_container->create($module);
139 139
 
140 140
 		// If not an object or not an instance of the module interface, throw.
141
-		if ( ! is_object( $instance )
142
-		|| ! is_a( $instance, Module::class, true )
141
+		if ( ! is_object($instance)
142
+		|| ! is_a($instance, Module::class, true)
143 143
 		) {
144
-			throw Module_Manager_Exception::invalid_module_class_name( esc_html( $module ) );
144
+			throw Module_Manager_Exception::invalid_module_class_name(esc_html($module));
145 145
 		}
146 146
 
147 147
 		return $instance;
@@ -153,27 +153,27 @@  discard block
 block discarded – undo
153 153
 	 * @param Module $module
154 154
 	 * @return Registration_Middleware|null
155 155
 	 */
156
-	private function create_middleware( Module $module ): ?Registration_Middleware {
156
+	private function create_middleware(Module $module): ?Registration_Middleware {
157 157
 		$middleware = $module->get_middleware();
158 158
 
159 159
 		// If no middleware is provided, return null.
160
-		if ( is_null( $middleware ) ) {
160
+		if (is_null($middleware)) {
161 161
 			return null;
162 162
 		}
163 163
 
164 164
 		// If not an object or not an instance of the module interface, throw.
165
-		if ( ! is_a( $middleware, Registration_Middleware::class, true ) ) {
166
-			throw Module_Manager_Exception::invalid_registration_middleware( $middleware ); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped, escaped in exception.
165
+		if ( ! is_a($middleware, Registration_Middleware::class, true)) {
166
+			throw Module_Manager_Exception::invalid_registration_middleware($middleware); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped, escaped in exception.
167 167
 		}
168 168
 
169 169
 		// Create the middleware.
170
-		$middleware = $this->di_container->create( $middleware );
170
+		$middleware = $this->di_container->create($middleware);
171 171
 
172 172
 		// If the middleware is not an object, throw.
173
-		if ( ! is_object( $middleware )
174
-		|| ! is_a( $middleware, Registration_Middleware::class, true )
173
+		if ( ! is_object($middleware)
174
+		|| ! is_a($middleware, Registration_Middleware::class, true)
175 175
 		) {
176
-			throw Module_Manager_Exception::failed_to_create_registration_middleware( $middleware ); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped, escaped in exception.
176
+			throw Module_Manager_Exception::failed_to_create_registration_middleware($middleware); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped, escaped in exception.
177 177
 		}
178 178
 
179 179
 		return $middleware;
@@ -185,10 +185,10 @@  discard block
 block discarded – undo
185 185
 	 * @param Module $module
186 186
 	 * @return void
187 187
 	 */
188
-	private function register_hooks( Module $module ): void {
189
-		add_action( Hooks::APP_INIT_PRE_BOOT, array( $module, 'pre_boot' ), 10, 3 );
190
-		add_action( Hooks::APP_INIT_PRE_REGISTRATION, array( $module, 'pre_register' ), 10, 3 );
191
-		add_action( Hooks::APP_INIT_POST_REGISTRATION, array( $module, 'post_register' ), 10, 3 );
188
+	private function register_hooks(Module $module): void {
189
+		add_action(Hooks::APP_INIT_PRE_BOOT, array($module, 'pre_boot'), 10, 3);
190
+		add_action(Hooks::APP_INIT_PRE_REGISTRATION, array($module, 'pre_register'), 10, 3);
191
+		add_action(Hooks::APP_INIT_POST_REGISTRATION, array($module, 'post_register'), 10, 3);
192 192
 	}
193 193
 
194 194
 	/**
Please login to merge, or discard this patch.
src/Services/Registration/Modules/Hookable_Middleware.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,10 +41,10 @@
 block discarded – undo
41 41
 	 * @param object $class
42 42
 	 * @return object
43 43
 	 */
44
-	public function process( object $class ): object {  // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.classFound
45
-		if ( in_array( Hookable::class, class_implements( $class ) ?: array(), true ) ) { // phpcs:ignore Universal.Operators.DisallowShortTernary.Found
44
+	public function process(object $class): object {  // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.classFound
45
+		if (in_array(Hookable::class, class_implements($class) ?: array(), true)) { // phpcs:ignore Universal.Operators.DisallowShortTernary.Found
46 46
 			/** @phpstan-ignore-next-line class must implement register for interface*/
47
-			$class->register( $this->loader );
47
+			$class->register($this->loader);
48 48
 		}
49 49
 		return $class;
50 50
 	}
Please login to merge, or discard this patch.
src/Services/Registration/Registration_Service.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	protected DI_Container $di_container;
55 55
 
56
-	public function __construct( DI_Container $di_container ) {
56
+	public function __construct(DI_Container $di_container) {
57 57
 		$this->di_container = $di_container;
58 58
 	}
59 59
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 	 * @param Registration_Middleware $middleware
64 64
 	 * @return self
65 65
 	 */
66
-	public function push_middleware( Registration_Middleware $middleware ): self {
67
-		$this->middleware[ \get_class( $middleware ) ] = $middleware;
66
+	public function push_middleware(Registration_Middleware $middleware): self {
67
+		$this->middleware[\get_class($middleware)] = $middleware;
68 68
 		return $this;
69 69
 	}
70 70
 
@@ -74,15 +74,15 @@  discard block
 block discarded – undo
74 74
 	 * @template Class_Name of object
75 75
 	 * @param class-string<Class_Name> $class_string
76 76
 	 */
77
-	public function push_class( string $class_string ): self {
77
+	public function push_class(string $class_string): self {
78 78
 		// If the class is already in the list, skip.
79
-		if ( \in_array( $class_string, $this->class_list, true ) ) {
79
+		if (\in_array($class_string, $this->class_list, true)) {
80 80
 			return $this;
81 81
 		}
82 82
 
83 83
 		// If $class_string is not a class, throw exception.
84
-		if ( ! \class_exists( $class_string ) ) {
85
-			throw Module_Manager_Exception::none_class_string_passed_to_registration( esc_html( $class_string ) );
84
+		if ( ! \class_exists($class_string)) {
85
+			throw Module_Manager_Exception::none_class_string_passed_to_registration(esc_html($class_string));
86 86
 		}
87 87
 
88 88
 		$this->class_list[] = $class_string;
@@ -96,25 +96,25 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public function process(): void {
98 98
 		// Filter all classes, before processing.
99
-		$class_list = apply_filters( Hooks::APP_INIT_REGISTRATION_CLASS_LIST, $this->class_list );
99
+		$class_list = apply_filters(Hooks::APP_INIT_REGISTRATION_CLASS_LIST, $this->class_list);
100 100
 
101 101
 		// If class list is empty, skip.
102
-		if ( empty( $class_list ) ) {
102
+		if (empty($class_list)) {
103 103
 			return;
104 104
 		}
105 105
 
106
-		foreach ( $this->middleware as $middleware ) {
106
+		foreach ($this->middleware as $middleware) {
107 107
 			// Run middleware setup
108 108
 			$middleware->setup();
109 109
 
110 110
 			// Pass each class to the middleware.
111
-			foreach ( $class_list as $class ) {
111
+			foreach ($class_list as $class) {
112 112
 				// Construct class using container,
113
-				$class_instance = $this->di_container->create( $class );
113
+				$class_instance = $this->di_container->create($class);
114 114
 
115 115
 				// if valid object process via current middleware
116
-				if ( is_object( $class_instance ) ) {
117
-					$middleware->process( $class_instance );
116
+				if (is_object($class_instance)) {
117
+					$middleware->process($class_instance);
118 118
 				}
119 119
 			}
120 120
 
Please login to merge, or discard this patch.
src/Exceptions/Module_Manager_Exception.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -35,20 +35,20 @@  discard block
 block discarded – undo
35 35
 	 * @param mixed $value
36 36
 	 * @return string
37 37
 	 */
38
-	private static function cast_to_string( $value ): string {
39
-		if ( is_object( $value ) ) {
40
-			return get_class( $value );
38
+	private static function cast_to_string($value): string {
39
+		if (is_object($value)) {
40
+			return get_class($value);
41 41
 		}
42 42
 
43
-		if ( is_array( $value ) ) {
44
-			return \wp_json_encode( $value ) ?: 'FAILED_TO_CAST ARRAY'; // phpcs:ignore Universal.Operators.DisallowShortTernary.Found
43
+		if (is_array($value)) {
44
+			return \wp_json_encode($value) ?: 'FAILED_TO_CAST ARRAY'; // phpcs:ignore Universal.Operators.DisallowShortTernary.Found
45 45
 		}
46 46
 
47
-		if ( is_null( $value ) ) {
47
+		if (is_null($value)) {
48 48
 			return 'NULL';
49 49
 		}
50 50
 
51
-		if ( is_bool( $value ) ) {
51
+		if (is_bool($value)) {
52 52
 			return $value ? 'BOOL::true' : 'BOOL::false';
53 53
 		}
54 54
 
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 	 * @param string $module
62 62
 	 * @return Module_Manager_Exception
63 63
 	 */
64
-	public static function invalid_module_class_name( string $module ): Module_Manager_Exception {
64
+	public static function invalid_module_class_name(string $module): Module_Manager_Exception {
65 65
 		$message = "{$module} must be an instance of the Module interface";
66
-		return new Module_Manager_Exception( $message, 20 );
66
+		return new Module_Manager_Exception($message, 20);
67 67
 	}
68 68
 
69 69
 	/**
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
 	 * @param mixed $created
74 74
 	 * @return Module_Manager_Exception
75 75
 	 */
76
-	public static function failed_to_create_registration_middleware( $created ): Module_Manager_Exception {
76
+	public static function failed_to_create_registration_middleware($created): Module_Manager_Exception {
77 77
 
78
-		$created = self::cast_to_string( $created );
78
+		$created = self::cast_to_string($created);
79 79
 
80 80
 		$message = "Failed to create Registration_Middleware, invalid instance created. Created: {$created}";
81
-		return new Module_Manager_Exception( $message, 21 );
81
+		return new Module_Manager_Exception($message, 21);
82 82
 	}
83 83
 
84 84
 	/**
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
 	 * @param mixed $created
89 89
 	 * @return Module_Manager_Exception
90 90
 	 */
91
-	public static function invalid_registration_middleware( $created ): Module_Manager_Exception {
92
-		$created = self::cast_to_string( $created );
91
+	public static function invalid_registration_middleware($created): Module_Manager_Exception {
92
+		$created = self::cast_to_string($created);
93 93
 
94 94
 		$message = "{$created} was returned as the modules Middleware, but this does not implement Registration_Middleware interface";
95
-		return new Module_Manager_Exception( $message, 22 );
95
+		return new Module_Manager_Exception($message, 22);
96 96
 	}
97 97
 
98 98
 	/**
@@ -102,10 +102,10 @@  discard block
 block discarded – undo
102 102
 	 * @param mixed $passed
103 103
 	 * @return Module_Manager_Exception
104 104
 	 */
105
-	public static function none_class_string_passed_to_registration( $passed ): Module_Manager_Exception {
106
-		$passed = self::cast_to_string( $passed );
105
+	public static function none_class_string_passed_to_registration($passed): Module_Manager_Exception {
106
+		$passed = self::cast_to_string($passed);
107 107
 
108 108
 		$message = "None class-string \"{$passed}\" passed to the registration class list";
109
-		return new Module_Manager_Exception( $message, 23 );
109
+		return new Module_Manager_Exception($message, 23);
110 110
 	}
111 111
 }
Please login to merge, or discard this patch.
src/Interfaces/Renderable.php 2 patches
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,6 @@
 block discarded – undo
48 48
 	/**
49 49
 	 * Renders a view Model
50 50
 	 *It is recommended not to use reserved keyword "print" as function parameter name. Found: $print
51
-
52 51
 	 * @param View_Model $view_model
53 52
 	 * @return string|void
54 53
 	 */
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @param boolean                 $print
36 36
 	 * @return void|string
37 37
 	 */
38
-	public function render( string $view, iterable $data, bool $print = true );
38
+	public function render(string $view, iterable $data, bool $print = true);
39 39
 
40 40
 	/**
41 41
 	 * Renders a component.
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @param Component $component
44 44
 	 * @return string|void
45 45
 	 */
46
-	public function component( Component $component, bool $print = true );
46
+	public function component(Component $component, bool $print = true);
47 47
 
48 48
 	/**
49 49
 	 * Renders a view Model
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 * @param View_Model $view_model
53 53
 	 * @return string|void
54 54
 	 */
55
-	public function view_model( View_Model $view_model, bool $print = true );
55
+	public function view_model(View_Model $view_model, bool $print = true);
56 56
 
57 57
 	/**
58 58
 	 * Sets the component compiler.
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 * @param Component_Compiler $compiler
61 61
 	 * @return void
62 62
 	 */
63
-	public function set_component_compiler( Component_Compiler $compiler ): void;
63
+	public function set_component_compiler(Component_Compiler $compiler): void;
64 64
 
65 65
 	/**
66 66
 	 * Returns the base view path.
Please login to merge, or discard this patch.