Passed
Pull Request — master (#170)
by
unknown
09:03
created
src/Interfaces/Module.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * @pram DI_Container $di_container
47 47
 	 * @return void
48 48
 	 */
49
-	public function pre_boot( App_Config $config, Hook_Loader $loader, DI_Container $di_container ): void;
49
+	public function pre_boot(App_Config $config, Hook_Loader $loader, DI_Container $di_container): void;
50 50
 
51 51
 
52 52
 	/**
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 * @pram DI_Container $di_container
58 58
 	 * @return void
59 59
 	 */
60
-	public function pre_register( App_Config $config, Hook_Loader $loader, DI_Container $di_container ): void;
60
+	public function pre_register(App_Config $config, Hook_Loader $loader, DI_Container $di_container): void;
61 61
 
62 62
 	/**
63 63
 	 * Callback fired after registration is completed.
@@ -67,5 +67,5 @@  discard block
 block discarded – undo
67 67
 	 * @pram DI_Container $di_container
68 68
 	 * @return void
69 69
 	 */
70
-	public function post_register( App_Config $config, Hook_Loader $loader, DI_Container $di_container ): void;
70
+	public function post_register(App_Config $config, Hook_Loader $loader, DI_Container $di_container): void;
71 71
 }
Please login to merge, or discard this patch.
src/Interfaces/DI_Container.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	 * @param array<string, mixed> $rule
37 37
 	 * @return DI_Container
38 38
 	 */
39
-	public function addRule( string $name, array $rule ): DI_Container;
39
+	public function addRule(string $name, array $rule): DI_Container;
40 40
 
41 41
 	/**
42 42
 	 * Add multiple rules
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * @param array<string, array<mixed>> $rules
45 45
 	 * @return DI_Container
46 46
 	 */
47
-	public function addRules( array $rules ): DI_Container;
47
+	public function addRules(array $rules): DI_Container;
48 48
 
49 49
 	/**
50 50
 	 * Create an instance of a class, with optional parameters.
@@ -53,5 +53,5 @@  discard block
 block discarded – undo
53 53
 	 * @param array<mixed> $args
54 54
 	 * @return object|null
55 55
 	 */
56
-	public function create( string $name, array $args = array() ): ?object;
56
+	public function create(string $name, array $args = array()): ?object;
57 57
 }
Please login to merge, or discard this patch.
src/Interfaces/Registration_Middleware.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 	 * @param T $class
38 38
 	 * @return T
39 39
 	 */
40
-	public function process( object $class ): object;
40
+	public function process(object $class): object;
41 41
 
42 42
 	/**
43 43
 	 * Used to for any middleware setup before process is called
Please login to merge, or discard this patch.
src/Services/View/Component/Component_Compiler.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 	private array $component_aliases = array();
51 51
 
52 52
 	/** @param array<string, string> $component_aliases */
53
-	public function __construct( string $component_base_path = '', array $component_aliases = array() ) {
53
+	public function __construct(string $component_base_path = '', array $component_aliases = array()) {
54 54
 		$this->component_base_path = $component_base_path;
55
-		$this->component_aliases   = \apply_filters( Hooks::COMPONENT_ALIASES, $component_aliases );
55
+		$this->component_aliases   = \apply_filters(Hooks::COMPONENT_ALIASES, $component_aliases);
56 56
 	}
57 57
 
58 58
 	/**
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 	 * @param Component $component
62 62
 	 * @return View_Model
63 63
 	 */
64
-	public function compile( Component $component ): View_Model {
65
-		return new View_Model( $this->get_component_path( $component ), $component->get_variables() );
64
+	public function compile(Component $component): View_Model {
65
+		return new View_Model($this->get_component_path($component), $component->get_variables());
66 66
 	}
67 67
 
68 68
 	/**
@@ -71,34 +71,34 @@  discard block
 block discarded – undo
71 71
 	 * @param Component $component
72 72
 	 * @return string
73 73
 	 */
74
-	private function get_component_path( Component $component ): string {
74
+	private function get_component_path(Component $component): string {
75 75
 
76 76
 		// Check aliases.
77
-		$aliases = \apply_filters( Hooks::COMPONENT_ALIASES, $this->component_aliases );
77
+		$aliases = \apply_filters(Hooks::COMPONENT_ALIASES, $this->component_aliases);
78 78
 
79
-		if ( isset( $aliases[ get_class( $component ) ] ) ) {
80
-			return esc_attr( $aliases[ get_class( $component ) ] );
79
+		if (isset($aliases[get_class($component)])) {
80
+			return esc_attr($aliases[get_class($component)]);
81 81
 		}
82 82
 
83
-		$from_annotation = $this->get_annotation( 'view', $component );
83
+		$from_annotation = $this->get_annotation('view', $component);
84 84
 
85 85
 		// If it does have a path defined, use that.
86
-		if ( ! empty( $from_annotation ) ) {
87
-			return \trailingslashit( $this->component_base_path ) . $from_annotation;
86
+		if ( ! empty($from_annotation)) {
87
+			return \trailingslashit($this->component_base_path) . $from_annotation;
88 88
 		}
89 89
 
90 90
 		// If the component has a defined path
91
-		if ( $component->template() ) {
92
-			return \trailingslashit( $this->component_base_path ) . $component->template();
91
+		if ($component->template()) {
92
+			return \trailingslashit($this->component_base_path) . $component->template();
93 93
 		}
94 94
 
95 95
 		// Get path based on class name.
96
-		$reflect    = new \ReflectionClass( $component );
96
+		$reflect    = new \ReflectionClass($component);
97 97
 		$short_name = $reflect->getShortName();
98 98
 		// Add space between capitals, make lowercase and replace underscores with dashes.
99
-		$short_name = strtolower( preg_replace( '/(?<!^)[A-Z]/', '$0', $short_name ) ?? '' );
100
-		$short_name = str_replace( '_', '-', $short_name );
101
-		return \trailingslashit( $this->component_base_path ) . $short_name;
99
+		$short_name = strtolower(preg_replace('/(?<!^)[A-Z]/', '$0', $short_name) ?? '');
100
+		$short_name = str_replace('_', '-', $short_name);
101
+		return \trailingslashit($this->component_base_path) . $short_name;
102 102
 	}
103 103
 
104 104
 	/**
@@ -108,18 +108,18 @@  discard block
 block discarded – undo
108 108
 	 * @param Component $component
109 109
 	 * @return string|null
110 110
 	 */
111
-	private function get_annotation( string $annotation, Component $component ): ?string {
112
-		$reflect = new \ReflectionClass( $component );
111
+	private function get_annotation(string $annotation, Component $component): ?string {
112
+		$reflect = new \ReflectionClass($component);
113 113
 		$comment = $reflect->getDocComment();
114 114
 
115 115
 		// if no comment, return null.
116
-		if ( empty( $comment ) ) {
116
+		if (empty($comment)) {
117 117
 			return null;
118 118
 		}
119 119
 
120 120
 		// Check if the comment contains the annotation "@{$annotation}" using regex.
121 121
 		$pattern = "/@{$annotation}\s+(.*)/";
122
-		preg_match( $pattern, $comment, $matches );
122
+		preg_match($pattern, $comment, $matches);
123 123
 
124 124
 		return $matches[1] ?? null;
125 125
 	}
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,12 +75,12 @@  discard block
 block discarded – undo
75 75
 	 * @param bool $print
76 76
 	 * @return string|void
77 77
 	 */
78
-	public function render( string $view, iterable $data, bool $print = true ) {
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) {
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
 		} else {
83
-			return $this->render_buffer( $view, $data );
83
+			return $this->render_buffer($view, $data);
84 84
 		}
85 85
 	}
86 86
 
@@ -90,21 +90,21 @@  discard block
 block discarded – undo
90 90
 	 * @param Component $component
91 91
 	 * @return string|void
92 92
 	 */
93
-	public function component( Component $component, bool $print = true ) {
93
+	public function component(Component $component, bool $print = true) {
94 94
 
95 95
 		// Throw exception of no compiler passed.
96
-		if ( ! Object_Helper::is_a( $this->component_compiler, Component_Compiler::class ) ) {
97
-			throw new Exception( 'No component compiler passed to PHP_Engine' );
96
+		if ( ! Object_Helper::is_a($this->component_compiler, Component_Compiler::class)) {
97
+			throw new Exception('No component compiler passed to PHP_Engine');
98 98
 		}
99 99
 
100 100
 		// Compile the component.
101
-		$compiled = $this->component_compiler->compile( $component ); // @phpstan-ignore-line, checked above.
102
-		$template = $this->maybe_resolve_dot_notation( $compiled->template() );
103
-		$view     = sprintf( '%s%s%s.php', $this->base_view_path, \DIRECTORY_SEPARATOR, trim( $template ) );
104
-		if ( $print ) {
105
-			print( $this->render_buffer( $view, $compiled->data() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
101
+		$compiled = $this->component_compiler->compile($component); // @phpstan-ignore-line, checked above.
102
+		$template = $this->maybe_resolve_dot_notation($compiled->template());
103
+		$view     = sprintf('%s%s%s.php', $this->base_view_path, \DIRECTORY_SEPARATOR, trim($template));
104
+		if ($print) {
105
+			print($this->render_buffer($view, $compiled->data())); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
106 106
 		} else {
107
-			return $this->render_buffer( $view, $compiled->data() );
107
+			return $this->render_buffer($view, $compiled->data());
108 108
 		}
109 109
 	}
110 110
 
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 	 * @param View_Model $view_model
116 116
 	 * @return string|void
117 117
 	 */
118
-	public function view_model( View_Model $view_model, bool $print = true ) {
119
-		return $this->render( $view_model->template(), $view_model->data(), $print );
118
+	public function view_model(View_Model $view_model, bool $print = true) {
119
+		return $this->render($view_model->template(), $view_model->data(), $print);
120 120
 	}
121 121
 
122 122
 	/**
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 	 * @param bool $print
128 128
 	 * @return string|void
129 129
 	 */
130
-	public function partial( string $view, iterable $data = array(), bool $print = true ) {
131
-		if ( $print ) {
132
-			$this->render( $view, $data, $print );
130
+	public function partial(string $view, iterable $data = array(), bool $print = true) {
131
+		if ($print) {
132
+			$this->render($view, $data, $print);
133 133
 		} else {
134
-			return $this->render( $view, $data, $print );
134
+			return $this->render($view, $data, $print);
135 135
 		}
136 136
 	}
137 137
 
@@ -143,27 +143,27 @@  discard block
 block discarded – undo
143 143
 	 * @return string
144 144
 	 * @throws Exception
145 145
 	 */
146
-	private function render_buffer( string $view, iterable $__data ): string {
146
+	private function render_buffer(string $view, iterable $__data): string {
147 147
 
148
-		if ( ! file_exists( $view ) ) {
149
-			throw new Exception( "{$view} doesn't exist" );
148
+		if ( ! file_exists($view)) {
149
+			throw new Exception("{$view} doesn't exist");
150 150
 		}
151 151
 
152 152
 		$output = '';
153 153
 		ob_start();
154 154
 
155 155
 		// Set all the data values a parameters.
156
-		foreach ( $__data as $__key => $__value ) {
157
-			if ( is_string( $__key ) ) {
158
-				${\wp_strip_all_tags( $__key )} = $__value;
156
+		foreach ($__data as $__key => $__value) {
157
+			if (is_string($__key)) {
158
+				${\wp_strip_all_tags($__key)} = $__value;
159 159
 			}
160 160
 
161 161
 			// Unset the key and value.
162
-			unset( $__key, $__value );
162
+			unset($__key, $__value);
163 163
 		}
164 164
 
165 165
 		// Unset the data.
166
-		unset( $__data );
166
+		unset($__data);
167 167
 
168 168
 		include $view;
169 169
 		$output = ob_get_contents();
@@ -177,12 +177,12 @@  discard block
 block discarded – undo
177 177
 	 * @param string $filename
178 178
 	 * @return string
179 179
 	 */
180
-	private function resolve_file_path( string $filename ): string {
181
-		$filename = $this->maybe_resolve_dot_notation( $filename );
180
+	private function resolve_file_path(string $filename): string {
181
+		$filename = $this->maybe_resolve_dot_notation($filename);
182 182
 		return sprintf(
183 183
 			'%s%s.php',
184 184
 			$this->base_view_path,
185
-			trim( $filename )
185
+			trim($filename)
186 186
 		);
187 187
 	}
188 188
 
@@ -192,13 +192,13 @@  discard block
 block discarded – undo
192 192
 	 * @param string $filename
193 193
 	 * @return string
194 194
 	 */
195
-	private function maybe_resolve_dot_notation( string $filename ): string {
196
-		if ( endsWith( '.php' )( $filename ) ) {
197
-			$filename = substr( $filename, 0, -4 );
195
+	private function maybe_resolve_dot_notation(string $filename): string {
196
+		if (endsWith('.php')($filename)) {
197
+			$filename = substr($filename, 0, -4);
198 198
 		}
199 199
 
200
-		$parts    = explode( '.', $filename );
201
-		$filename = implode( DIRECTORY_SEPARATOR, $parts );
200
+		$parts    = explode('.', $filename);
201
+		$filename = implode(DIRECTORY_SEPARATOR, $parts);
202 202
 
203 203
 		return $filename;
204 204
 	}
@@ -210,12 +210,12 @@  discard block
 block discarded – undo
210 210
 	 * @return string
211 211
 	 * @throws Exception
212 212
 	 */
213
-	private function verify_view_path( string $path ): string {
214
-		$path = $this->maybe_resolve_dot_notation( $path );
215
-		$path = rtrim( $path, '/' ) . '/';
213
+	private function verify_view_path(string $path): string {
214
+		$path = $this->maybe_resolve_dot_notation($path);
215
+		$path = rtrim($path, '/') . '/';
216 216
 
217
-		if ( ! \is_dir( $path ) ) {
218
-			throw new Exception( "{$path} doesn't exist and cant be used as the base view path." );
217
+		if ( ! \is_dir($path)) {
218
+			throw new Exception("{$path} doesn't exist and cant be used as the base view path.");
219 219
 		}
220 220
 
221 221
 		return $path;
Please login to merge, or discard this patch.
src/Services/View/View_Model.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
 	private array $data = array();
43 43
 
44 44
 	/** @param array<string, mixed> $data */
45
-	public function __construct( string $template, array $data = array() ) {
45
+	public function __construct(string $template, array $data = array()) {
46 46
 		$this->template = $template;
47 47
 		$this->data     = $data;
48 48
 	}
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( "{$id} not defined in container", 1 );
67
+	public function get(string $id): ?object {
68
+		if ( ! $this->has($id)) {
69
+			throw new DI_Container_Exception("{$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 bool
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/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
 
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
 	 * @template Class_Name of object
74 74
 	 * @param class-string<Class_Name> $class
75 75
 	 */
76
-	public function push_class( string $class ): self {
76
+	public function push_class(string $class): self {
77 77
 		// If the class is already in the list, skip.
78
-		if ( \in_array( $class, $this->class_list, true ) ) {
78
+		if (\in_array($class, $this->class_list, true)) {
79 79
 			return $this;
80 80
 		}
81 81
 
82 82
 		// If $class is not a class, throw exception.
83
-		if ( ! \class_exists( $class ) ) {
84
-			throw Module_Manager_Exception::none_class_string_passed_to_registration( $class );
83
+		if ( ! \class_exists($class)) {
84
+			throw Module_Manager_Exception::none_class_string_passed_to_registration($class);
85 85
 		}
86 86
 
87 87
 		$this->class_list[] = $class;
@@ -95,25 +95,25 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function process(): void {
97 97
 		// Filter all classes, before processing.
98
-		$class_list = apply_filters( Hooks::APP_INIT_REGISTRATION_CLASS_LIST, $this->class_list );
98
+		$class_list = apply_filters(Hooks::APP_INIT_REGISTRATION_CLASS_LIST, $this->class_list);
99 99
 
100 100
 		// If class list is empty, skip.
101
-		if ( empty( $class_list ) ) {
101
+		if (empty($class_list)) {
102 102
 			return;
103 103
 		}
104 104
 
105
-		foreach ( $this->middleware as $middleware ) {
105
+		foreach ($this->middleware as $middleware) {
106 106
 			// Run middleware setup
107 107
 			$middleware->setup();
108 108
 
109 109
 			// Pass each class to the middleware.
110
-			foreach ( $class_list as $class ) {
110
+			foreach ($class_list as $class) {
111 111
 				// Construct class using container,
112
-				$class_instance = $this->di_container->create( $class );
112
+				$class_instance = $this->di_container->create($class);
113 113
 
114 114
 				// if valid object process via current middleware
115
-				if ( is_object( $class_instance ) ) {
116
-					$middleware->process( $class_instance );
115
+				if (is_object($class_instance)) {
116
+					$middleware->process($class_instance);
117 117
 				}
118 118
 			}
119 119
 
Please login to merge, or discard this patch.
src/Services/Registration/Modules/Hookable_Module.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 * @pram DI_Container $di_container
52 52
 	 * @return void
53 53
 	 */
54
-	public function pre_boot( App_Config $config, Hook_Loader $loader, DI_Container $di_container ): void {
54
+	public function pre_boot(App_Config $config, Hook_Loader $loader, DI_Container $di_container): void {
55 55
 	}
56 56
 
57 57
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @pram DI_Container $di_container
64 64
 	 * @return void
65 65
 	 */
66
-	public function pre_register( App_Config $config, Hook_Loader $loader, DI_Container $di_container ): void {
66
+	public function pre_register(App_Config $config, Hook_Loader $loader, DI_Container $di_container): void {
67 67
 	}
68 68
 
69 69
 	/**
@@ -74,6 +74,6 @@  discard block
 block discarded – undo
74 74
 	 * @pram DI_Container $di_container
75 75
 	 * @return void
76 76
 	 */
77
-	public function post_register( App_Config $config, Hook_Loader $loader, DI_Container $di_container ): void {
77
+	public function post_register(App_Config $config, Hook_Loader $loader, DI_Container $di_container): void {
78 78
 	}
79 79
 }
Please login to merge, or discard this patch.