Passed
Pull Request — master (#43)
by Glynn
07:58
created
src/Page/Menu_Page.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 * @param View $view  View
107 107
 	 * @return self
108 108
 	 */
109
-	public function set_view( View $view ): self {
109
+	public function set_view(View $view): self {
110 110
 		$this->view = $view;
111 111
 		return $this;
112 112
 	}
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 	 * @return string
123 123
 	 */
124 124
 	public function slug(): string {
125
-		if ( $this->page_slug === '' ) {
126
-			throw Page_Exception::undefined_property( 'page_slug', $this );
125
+		if ($this->page_slug === '') {
126
+			throw Page_Exception::undefined_property('page_slug', $this);
127 127
 		}
128 128
 		return $this->page_slug;
129 129
 	}
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 	 * @return string
133 133
 	 */
134 134
 	public function menu_title(): string {
135
-		if ( $this->menu_title === '' ) {
136
-			throw Page_Exception::undefined_property( 'menu_title', $this );
135
+		if ($this->menu_title === '') {
136
+			throw Page_Exception::undefined_property('menu_title', $this);
137 137
 		}
138 138
 		return $this->menu_title;
139 139
 	}
@@ -167,17 +167,17 @@  discard block
 block discarded – undo
167 167
 	 * @throws Page_Exception code 201 if template not defined.
168 168
 	 */
169 169
 	public function render_view(): callable {
170
-		if ( null === $this->view ) {
171
-			throw Page_Exception::view_not_set( $this );
170
+		if (null === $this->view) {
171
+			throw Page_Exception::view_not_set($this);
172 172
 		}
173 173
 
174
-		if ( '' === $this->view_template ) {
175
-			throw Page_Exception::undefined_property( 'view_template', $this );
174
+		if ('' === $this->view_template) {
175
+			throw Page_Exception::undefined_property('view_template', $this);
176 176
 		}
177 177
 
178 178
 		return function() {
179 179
 			// @phpstan-ignore-next-line, as we have already checked for null.
180
-			$this->view->render( $this->view_template, $this->view_data );
180
+			$this->view->render($this->view_template, $this->view_data);
181 181
 		};
182 182
 
183 183
 	}
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 * @return void
190 190
 	 * @codeCoverageIgnore This can be tested as it does nothing and is extended only
191 191
 	 */
192
-	public function enqueue( Page $page ): void {
192
+	public function enqueue(Page $page): void {
193 193
 		// Do nothing.
194 194
 		// Can be extended in any child class that extends.
195 195
 	}
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 * @return void
202 202
 	 * @codeCoverageIgnore This can be tested as it does nothing and is extended only
203 203
 	 */
204
-	public function load( Page $page ): void {
204
+	public function load(Page $page): void {
205 205
 		// Do nothing.
206 206
 		// Can be extended in any child class that extends.
207 207
 	}
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	 * @param string $page_hook
213 213
 	 * @return void
214 214
 	 */
215
-	final public function set_page_hook( string $page_hook ): void {
215
+	final public function set_page_hook(string $page_hook): void {
216 216
 		$this->page_hook = $page_hook;
217 217
 	}
218 218
 
Please login to merge, or discard this patch.
src/Module/Page_Middleware.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -53,42 +53,42 @@  discard block
 block discarded – undo
53 53
 	 * @param object $class
54 54
 	 * @return object
55 55
 	 */
56
-	public function process( object $class ): object {
56
+	public function process(object $class): object {
57 57
 		// If we have a valid SUB page.
58 58
 		if (
59
-			is_a( $class, Page::class )
59
+			is_a($class, Page::class)
60 60
 			&& is_admin()
61
-			&& ! is_null( $class->parent_slug() )
61
+			&& ! is_null($class->parent_slug())
62 62
 		) {
63 63
 			$this->add_to_loader(
64
-				function () use ( $class ) : void {
65
-					$this->dispatcher->register_subpage( $class, $class->parent_slug() );
64
+				function() use ($class) : void {
65
+					$this->dispatcher->register_subpage($class, $class->parent_slug());
66 66
 				}
67 67
 			);
68 68
 		}
69 69
 
70 70
 		// If we have a valid SINGLE/PARENT page.
71 71
 		if (
72
-			is_a( $class, Page::class )
72
+			is_a($class, Page::class)
73 73
 			&& is_admin()
74
-			&& is_null( $class->parent_slug() )
74
+			&& is_null($class->parent_slug())
75 75
 		) {
76 76
 			$this->add_to_loader(
77
-				function () use ( $class ) : void {
78
-					$this->dispatcher->register_single_page( $class );
77
+				function() use ($class) : void {
78
+					$this->dispatcher->register_single_page($class);
79 79
 				}
80 80
 			);
81 81
 		}
82 82
 
83 83
 		// If we have a valid group.
84 84
 		if (
85
-			is_a( $class, Abstract_Group::class )
85
+			is_a($class, Abstract_Group::class)
86 86
 			&& is_admin()
87 87
 		) {
88 88
 
89 89
 			$this->add_to_loader(
90
-				function () use ( $class ): void {
91
-					$this->dispatcher->register_group( $class );
90
+				function() use ($class): void {
91
+					$this->dispatcher->register_group($class);
92 92
 				}
93 93
 			);
94 94
 		}
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 	 * @param callable $callback
102 102
 	 * @return void
103 103
 	 */
104
-	protected function add_to_loader( callable $callback ): void {
105
-		$this->hook_loader->action( 'admin_menu', $callback );
104
+	protected function add_to_loader(callable $callback): void {
105
+		$this->hook_loader->action('admin_menu', $callback);
106 106
 	}
107 107
 
108 108
 
Please login to merge, or discard this patch.
src/Module/Admin_Menu.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 	}
39 39
 
40 40
 	## Unused methods
41
-	public function pre_register( App_Config $config, Hook_Loader $loader, DI_Container $di_container ): void {} // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed
42
-	public function pre_boot( App_Config $config, Hook_Loader $loader, DI_Container $di_container ): void {} // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed
43
-	public function post_register( App_Config $config, Hook_Loader $loader, DI_Container $di_container ): void {} // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed
41
+	public function pre_register(App_Config $config, Hook_Loader $loader, DI_Container $di_container): void {} // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed
42
+	public function pre_boot(App_Config $config, Hook_Loader $loader, DI_Container $di_container): void {} // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed
43
+	public function post_register(App_Config $config, Hook_Loader $loader, DI_Container $di_container): void {} // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed
44 44
 }
Please login to merge, or discard this patch.