Passed
Pull Request — master (#56)
by
unknown
02:13
created
src/Exception/Group_Exception.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -38,11 +38,11 @@  discard block
 block discarded – undo
38 38
 	 * @return self
39 39
 	 * @code 250
40 40
 	 */
41
-	public static function primary_page_undefined( Abstract_Group $group ): self {
41
+	public static function primary_page_undefined(Abstract_Group $group): self {
42 42
 		return new self(
43 43
 			sprintf(
44 44
 				'The primary page is not defined in %s',
45
-				get_class( $group )
45
+				get_class($group)
46 46
 			),
47 47
 			250
48 48
 		);
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 	 * @return self
56 56
 	 * @code 251
57 57
 	 */
58
-	public static function group_title_undefined( Abstract_Group $group ): self {
58
+	public static function group_title_undefined(Abstract_Group $group): self {
59 59
 		return new self(
60 60
 			sprintf(
61 61
 				'The group title is not defined in %s',
62
-				get_class( $group )
62
+				get_class($group)
63 63
 			),
64 64
 			251
65 65
 		);
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
 	 * @return self
74 74
 	 * @code 252
75 75
 	 */
76
-	public static function failed_validation( Group_Validator $validator, Abstract_Group $group ): self {
76
+	public static function failed_validation(Group_Validator $validator, Abstract_Group $group): self {
77 77
 		return new self(
78 78
 			sprintf(
79 79
 				'%s failed Group validation (%s)',
80
-				get_class( $group ),
81
-				join( ',', $validator->get_errors() )
80
+				get_class($group),
81
+				join(',', $validator->get_errors())
82 82
 			),
83 83
 			252
84 84
 		);
Please login to merge, or discard this patch.
src/Validator/Group_Validator.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -35,15 +35,15 @@  discard block
 block discarded – undo
35 35
 	 * @param mixed $group
36 36
 	 * @return bool
37 37
 	 */
38
-	public function validate( $group ): bool {
38
+	public function validate($group): bool {
39 39
 		$this->reset_errors();
40 40
 
41
-		if ( ! is_a( $group, Abstract_Group::class ) ) {
42
-			$this->push_error( sprintf( '%s Is not a valid group type.', get_class( $group ) ) );
41
+		if ( ! is_a($group, Abstract_Group::class)) {
42
+			$this->push_error(sprintf('%s Is not a valid group type.', get_class($group)));
43 43
 			return false;
44 44
 		}
45 45
 
46
-		return $this->check_properties( $group );
46
+		return $this->check_properties($group);
47 47
 	}
48 48
 
49 49
 	/**
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
 	 * @param \PinkCrab\Perique_Admin_Menu\Group\Abstract_Group $group
54 54
 	 * @return bool
55 55
 	 */
56
-	protected function check_properties( Abstract_Group $group ): bool {
56
+	protected function check_properties(Abstract_Group $group): bool {
57 57
 		try {
58 58
 			$group->get_primary_page();
59 59
 			$group->get_group_title();
60
-		} catch ( \Throwable $th ) {
61
-			$this->push_error( $th->getMessage() );
60
+		} catch (\Throwable $th) {
61
+			$this->push_error($th->getMessage());
62 62
 			return false;
63 63
 		}
64 64
 		return true;
Please login to merge, or discard this patch.
src/Exception/Page_Exception.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,11 +37,11 @@  discard block
 block discarded – undo
37 37
 	 * @return self
38 38
 	 * @code 200
39 39
 	 */
40
-	public static function view_not_set( Page $page ): self {
40
+	public static function view_not_set(Page $page): self {
41 41
 		return new self(
42 42
 			sprintf(
43 43
 				'View must be defined in %s to render template',
44
-				get_class( $page )
44
+				get_class($page)
45 45
 			),
46 46
 			200
47 47
 		);
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
 	 * @return self
55 55
 	 * @code 201
56 56
 	 */
57
-	public static function undefined_property( string $property, Page $page ): self {
57
+	public static function undefined_property(string $property, Page $page): self {
58 58
 		return new self(
59 59
 			sprintf(
60 60
 				'%s is a required property, not set in %s',
61 61
 				$property,
62
-				get_class( $page )
62
+				get_class($page)
63 63
 			),
64 64
 			201
65 65
 		);
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
 	 * @return self
74 74
 	 * @code 202
75 75
 	 */
76
-	public static function invalid_page_type( $page ): self {
76
+	public static function invalid_page_type($page): self {
77 77
 		return new self(
78 78
 			sprintf(
79 79
 				'%s is not defined in the Registrar and can not be registered.',
80
-				is_object( $page ) ? get_class( $page ) : 'UNKONW TYPE'
80
+				is_object($page) ? get_class($page) : 'UNKONW TYPE'
81 81
 			),
82 82
 			202
83 83
 		);
Please login to merge, or discard this patch.
src/Page/Page.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,13 +58,13 @@
 block discarded – undo
58 58
 	 * @param Page $page
59 59
 	 * @return void
60 60
 	 */
61
-	public function enqueue( Page $page ): void;
61
+	public function enqueue(Page $page): void;
62 62
 
63 63
 	/**
64 64
 	 * @param Page $page
65 65
 	 * @return void
66 66
 	 */
67
-	public function load( Page $page ): void;
67
+	public function load(Page $page): void;
68 68
 
69 69
 	/**
70 70
 	 * @return ?string
Please login to merge, or discard this patch.
src/Registrar/Registrar.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 	 * @param \PinkCrab\Perique_Admin_Menu\Group\Abstract_Group|null $group
42 42
 	 * @return void
43 43
 	 */
44
-	public function register_primary( Page $page, ?Abstract_Group $group = null ): void {
44
+	public function register_primary(Page $page, ?Abstract_Group $group = null): void {
45 45
 
46
-		switch ( true ) {
46
+		switch (true) {
47 47
 			// For menu pages
48 48
 			case $page instanceof Menu_Page:
49 49
 				/** @var Menu_Page $page */
@@ -56,20 +56,20 @@  discard block
 block discarded – undo
56 56
 					$page->slug(),
57 57
 					$page->render_view(),
58 58
 					$group ? $group->get_icon() : '',
59
-					(int) ( $group ? $group->get_position() : $page->position() )
59
+					(int) ($group ? $group->get_position() : $page->position())
60 60
 				);
61 61
 
62
-				$page->set_page_hook( $hook );
62
+				$page->set_page_hook($hook);
63 63
 
64 64
 				// Register Enqueue hooks for page/group.
65
-				$this->enqueue_scripts( $hook, $page, $group );
65
+				$this->enqueue_scripts($hook, $page, $group);
66 66
 				// Register hook for pre-load page
67
-				$this->pre_load_hook( $hook, $page, $group );
67
+				$this->pre_load_hook($hook, $page, $group);
68 68
 
69 69
 				break;
70 70
 
71 71
 			default:
72
-				do_action( Hooks::PAGE_REGISTRAR_PRIMARY, $page, $group );
72
+				do_action(Hooks::PAGE_REGISTRAR_PRIMARY, $page, $group);
73 73
 		}
74 74
 	}
75 75
 
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 	 * @param \PinkCrab\Perique_Admin_Menu\Group\Abstract_Group|null $group
82 82
 	 * @return void
83 83
 	 */
84
-	public function register_subpage( Page $page, string $parent_slug, ?Abstract_Group $group = null ): void {
85
-		switch ( true ) {
84
+	public function register_subpage(Page $page, string $parent_slug, ?Abstract_Group $group = null): void {
85
+		switch (true) {
86 86
 			case $page instanceof Menu_Page:
87 87
 				/** @var Menu_Page $page */
88 88
 				$page = $page;
@@ -98,22 +98,22 @@  discard block
 block discarded – undo
98 98
 				);
99 99
 
100 100
 				// If the sub page cant be registered because of permissions. Then we need to register the page as a primary page.
101
-				if ( ! is_string( $hook ) ) {
101
+				if ( ! is_string($hook)) {
102 102
 					return;
103 103
 				}
104 104
 
105 105
 				// Set the pages hook.
106
-				$page->set_page_hook( $hook );
106
+				$page->set_page_hook($hook);
107 107
 
108 108
 				// Register Enqueue hooks for page/group.
109
-				$this->enqueue_scripts( $page->page_hook() ?? $hook, $page, $group );
109
+				$this->enqueue_scripts($page->page_hook() ?? $hook, $page, $group);
110 110
 
111 111
 				// Register hook for pre-load page
112
-				$this->pre_load_hook( $page->page_hook() ?? $hook, $page, $group );
112
+				$this->pre_load_hook($page->page_hook() ?? $hook, $page, $group);
113 113
 
114 114
 				break;
115 115
 			default:
116
-				do_action( Hooks::PAGE_REGISTRAR_SUB, $page, $parent_slug );
116
+				do_action(Hooks::PAGE_REGISTRAR_SUB, $page, $parent_slug);
117 117
 		}
118 118
 	}
119 119
 
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
 	 * @param \PinkCrab\Perique_Admin_Menu\Group\Abstract_Group|null $group
126 126
 	 * @return void
127 127
 	 */
128
-	protected function enqueue_scripts( string $hook, Page $page, ?Abstract_Group $group = null ): void {
129
-		add_action( 'admin_enqueue_scripts', new Page_Enqueue_Action( $hook, $page, $group ) );
128
+	protected function enqueue_scripts(string $hook, Page $page, ?Abstract_Group $group = null): void {
129
+		add_action('admin_enqueue_scripts', new Page_Enqueue_Action($hook, $page, $group));
130 130
 	}
131 131
 
132 132
 	/**
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * @param \PinkCrab\Perique_Admin_Menu\Group\Abstract_Group|null $group
138 138
 	 * @return void
139 139
 	 */
140
-	protected function pre_load_hook( string $hook, Page $page, ?Abstract_Group $group = null ): void {
141
-		add_action( 'load-' . $hook, new Page_Load_Action( $page, $group ) );
140
+	protected function pre_load_hook(string $hook, Page $page, ?Abstract_Group $group = null): void {
141
+		add_action('load-' . $hook, new Page_Load_Action($page, $group));
142 142
 	}
143 143
 }
Please login to merge, or discard this patch.
src/Registrar/Page_Enqueue_Action.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	/** The option group being enqueued */
39 39
 	protected ?Abstract_Group $group;
40 40
 
41
-	public function __construct( string $hook, Page $page, ?Abstract_Group $group = null ) {
41
+	public function __construct(string $hook, Page $page, ?Abstract_Group $group = null) {
42 42
 		$this->hook  = $hook;
43 43
 		$this->page  = $page;
44 44
 		$this->group = $group;
@@ -50,15 +50,15 @@  discard block
 block discarded – undo
50 50
 	 * @param string $page_hook
51 51
 	 * @return void
52 52
 	 */
53
-	public function __invoke( string $page_hook ) {
54
-		if ( $page_hook === $this->hook ) {
53
+	public function __invoke(string $page_hook) {
54
+		if ($page_hook === $this->hook) {
55 55
 
56 56
 			// Register hooks for the group if part of group
57
-			if ( null !== $this->group ) {
58
-				$this->group->enqueue( $this->group, $this->page );
57
+			if (null !== $this->group) {
58
+				$this->group->enqueue($this->group, $this->page);
59 59
 			}
60 60
 
61
-			$this->page->enqueue( $this->page );
61
+			$this->page->enqueue($this->page);
62 62
 		}
63 63
 	}
64 64
 }
Please login to merge, or discard this patch.
src/Registrar/Page_Load_Action.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	/** The option group being enqueued  */
35 35
 	protected ?Abstract_Group $group;
36 36
 
37
-	public function __construct( Page $page, ?Abstract_Group $group = null ) {
37
+	public function __construct(Page $page, ?Abstract_Group $group = null) {
38 38
 		$this->page  = $page;
39 39
 		$this->group = $group;
40 40
 	}
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function __invoke() {
48 48
 		// Register hooks for the group if part of group
49
-		if ( null !== $this->group ) {
50
-			$this->group->load( $this->group, $this->page );
49
+		if (null !== $this->group) {
50
+			$this->group->load($this->group, $this->page);
51 51
 		}
52 52
 
53
-		$this->page->load( $this->page );
53
+		$this->page->load($this->page);
54 54
 	}
55 55
 }
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.
src/Registrar/Page_Dispatcher.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@
 block discarded – undo
136 136
 	 */
137 137
 	protected function get_primary_page( Abstract_Group $group ): Page {
138 138
 		/**
139
- * @var Page
139
+		 * @var Page
140 140
 */
141 141
 		$page = $this->di_container->create( $group->get_primary_page() );
142 142
 
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	protected View $view;
41 41
 	protected Registrar $registrar;
42 42
 
43
-	public function __construct( DI_Container $di_container, View $view, Registrar $registrar ) {
43
+	public function __construct(DI_Container $di_container, View $view, Registrar $registrar) {
44 44
 		$this->di_container = $di_container;
45 45
 		$this->view         = $view;
46 46
 		$this->registrar    = $registrar;
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
 	 * @param \PinkCrab\Perique_Admin_Menu\Group\Abstract_Group $group
53 53
 	 * @return void
54 54
 	 */
55
-	public function register_group( Abstract_Group $group ): void {
55
+	public function register_group(Abstract_Group $group): void {
56 56
 
57 57
 		// If current user can not access the group, bail without attempting to register.
58
-		if ( ! current_user_can( $group->get_capability() ) ) {
58
+		if ( ! current_user_can($group->get_capability())) {
59 59
 			return;
60 60
 		}
61 61
 
@@ -63,19 +63,19 @@  discard block
 block discarded – undo
63 63
 
64 64
 			// Validate the group.
65 65
 			$validator = new Group_Validator();
66
-			if ( ! $validator->validate( $group ) ) {
67
-				throw Group_Exception::failed_validation( $validator, $group );
66
+			if ( ! $validator->validate($group)) {
67
+				throw Group_Exception::failed_validation($validator, $group);
68 68
 			}
69 69
 
70
-			$this->register_primary_page( $group );
70
+			$this->register_primary_page($group);
71 71
 
72 72
 			// Register all pages and attempt to set primary page name in menu.
73
-			foreach ( $this->get_pages( $group ) as $page ) {
74
-				$this->register_subpage( $page, $this->get_primary_page( $group )->slug(), $group );
73
+			foreach ($this->get_pages($group) as $page) {
74
+				$this->register_subpage($page, $this->get_primary_page($group)->slug(), $group);
75 75
 			}
76
-			$this->set_primary_page_details( $group );
77
-		} catch ( \Throwable $th ) {
78
-			$this->admin_exception_notice( $group, $th );
76
+			$this->set_primary_page_details($group);
77
+		} catch (\Throwable $th) {
78
+			$this->admin_exception_notice($group, $th);
79 79
 		}
80 80
 	}
81 81
 
@@ -86,22 +86,22 @@  discard block
 block discarded – undo
86 86
 	 * @param \Throwable          $exception
87 87
 	 * @return void
88 88
 	 */
89
-	public function admin_exception_notice( $object_instance, Throwable $exception ): void {
89
+	public function admin_exception_notice($object_instance, Throwable $exception): void {
90 90
 		add_action(
91 91
 			'admin_notices',
92
-			function () use ( $object_instance, $exception ) {
92
+			function() use ($object_instance, $exception) {
93 93
 				$class   = 'notice notice-error';
94 94
 				$message = sprintf(
95 95
 					'%s <i>%s</i> generated errors while being registered. This might result in admin pages being missing or broken. <br><b>%s(%s: %s)</b>',
96
-					get_class( $object_instance ) === Page::class ? 'Page' : 'Menu Group',
97
-					get_class( $object_instance ),
96
+					get_class($object_instance) === Page::class ? 'Page' : 'Menu Group',
97
+					get_class($object_instance),
98 98
 					$exception->getMessage(),
99 99
 					$exception->getFile(),
100 100
 					$exception->getLine()
101 101
 				);
102 102
 				printf(
103 103
 					'<div class="%1$s"><p>%2$s</p></div>',
104
-					esc_attr( $class ),
104
+					esc_attr($class),
105 105
 					wp_kses(
106 106
 						$message,
107 107
 						array(
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 	 * @param \PinkCrab\Perique_Admin_Menu\Group\Abstract_Group $group
122 122
 	 * @return void
123 123
 	 */
124
-	protected function register_primary_page( Abstract_Group $group ): void {
124
+	protected function register_primary_page(Abstract_Group $group): void {
125 125
 		$this->registrar->register_primary(
126
-			$this->get_primary_page( $group ),
126
+			$this->get_primary_page($group),
127 127
 			$group
128 128
 		);
129 129
 	}
@@ -134,19 +134,19 @@  discard block
 block discarded – undo
134 134
 	 * @param \PinkCrab\Perique_Admin_Menu\Group\Abstract_Group $group
135 135
 	 * @return \PinkCrab\Perique_Admin_Menu\Page\Page
136 136
 	 */
137
-	protected function get_primary_page( Abstract_Group $group ): Page {
137
+	protected function get_primary_page(Abstract_Group $group): Page {
138 138
 		/**
139 139
  * @var Page
140 140
 */
141
-		$page = $this->di_container->create( $group->get_primary_page() );
141
+		$page = $this->di_container->create($group->get_primary_page());
142 142
 
143
-		if ( ! is_object( $page ) || ! is_a( $page, Page::class ) ) {
144
-			throw Page_Exception::invalid_page_type( $page ); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped, escaped in exception.
143
+		if ( ! is_object($page) || ! is_a($page, Page::class)) {
144
+			throw Page_Exception::invalid_page_type($page); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped, escaped in exception.
145 145
 		}
146 146
 
147 147
 		// Register view if requied.
148
-		if ( \method_exists( $page, 'set_view' ) ) {
149
-			$page->set_view( $this->view );
148
+		if (\method_exists($page, 'set_view')) {
149
+			$page->set_view($this->view);
150 150
 		}
151 151
 
152 152
 		return $page;
@@ -160,18 +160,18 @@  discard block
 block discarded – undo
160 160
 	 * @return array<Page>
161 161
 	 * @throws Page_Exception (Code 202)
162 162
 	 */
163
-	protected function get_pages( Abstract_Group $group ): array {
163
+	protected function get_pages(Abstract_Group $group): array {
164 164
 		return array_map(
165
-			function ( string $page ): Page {
166
-				$constructed_page = $this->di_container->create( $page );
167
-				if ( ! is_object( $constructed_page ) || ! is_a( $constructed_page, Page::class ) ) {
168
-					throw Page_Exception::invalid_page_type( $constructed_page ); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped, escaped in exception.
165
+			function(string $page): Page {
166
+				$constructed_page = $this->di_container->create($page);
167
+				if ( ! is_object($constructed_page) || ! is_a($constructed_page, Page::class)) {
168
+					throw Page_Exception::invalid_page_type($constructed_page); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped, escaped in exception.
169 169
 				}
170 170
 				return $constructed_page;
171 171
 			},
172 172
 			array_filter(
173 173
 				$group->get_pages(),
174
-				function ( string $page ) use ( $group ) {
174
+				function(string $page) use ($group) {
175 175
 					return $page !== $group->get_primary_page();
176 176
 				}
177 177
 			)
@@ -187,22 +187,22 @@  discard block
 block discarded – undo
187 187
 	 * @phpcs:disable WordPress.WP.GlobalVariablesOverride.Prohibited
188 188
 	 * @throws Group_Exception (code 253)
189 189
 	 */
190
-	protected function set_primary_page_details( Abstract_Group $group ) {
190
+	protected function set_primary_page_details(Abstract_Group $group) {
191 191
 		global $submenu;
192 192
 
193
-		$primary = $this->get_primary_page( $group );
193
+		$primary = $this->get_primary_page($group);
194 194
 
195
-		if ( ! array_key_exists( $primary->slug(), $submenu ) ) {
195
+		if ( ! array_key_exists($primary->slug(), $submenu)) {
196 196
 			return;
197 197
 		}
198 198
 
199 199
 		$primary_page_key = array_search(
200 200
 			$primary->slug(),
201
-			\array_column( $submenu[ $primary->slug() ], 2 ),
201
+			\array_column($submenu[$primary->slug()], 2),
202 202
 			true
203 203
 		) ?: 0; // phpcs:ignore Universal.Operators.DisallowShortTernary.Found
204 204
 
205
-		$submenu[ $primary->slug() ][ $primary_page_key ][0] = $primary->menu_title();
205
+		$submenu[$primary->slug()][$primary_page_key][0] = $primary->menu_title();
206 206
 	}
207 207
 
208 208
 
@@ -214,21 +214,21 @@  discard block
 block discarded – undo
214 214
 	 * @param \PinkCrab\Perique_Admin_Menu\Group\Abstract_Group|null $group
215 215
 	 * @return void
216 216
 	 */
217
-	public function register_subpage( Page $page, string $parent_slug, ?Abstract_Group $group = null ): void {
217
+	public function register_subpage(Page $page, string $parent_slug, ?Abstract_Group $group = null): void {
218 218
 		// If user cant access the page, bail before attempting to register.
219
-		if ( ! current_user_can( $page->capability() ) ) {
219
+		if ( ! current_user_can($page->capability())) {
220 220
 			return;
221 221
 		}
222 222
 
223 223
 		// Register view if required.
224
-		if ( \method_exists( $page, 'set_view' ) ) {
225
-			$page->set_view( $this->view );
224
+		if (\method_exists($page, 'set_view')) {
225
+			$page->set_view($this->view);
226 226
 		}
227 227
 
228 228
 		try {
229
-			$this->registrar->register_subpage( $page, $parent_slug, $group );
230
-		} catch ( \Throwable $th ) {
231
-			$this->admin_exception_notice( $page, $th );
229
+			$this->registrar->register_subpage($page, $parent_slug, $group);
230
+		} catch (\Throwable $th) {
231
+			$this->admin_exception_notice($page, $th);
232 232
 		}
233 233
 	}
234 234
 
@@ -238,16 +238,16 @@  discard block
 block discarded – undo
238 238
 	 * @param \PinkCrab\Perique_Admin_Menu\Page\Page $page
239 239
 	 * @return void
240 240
 	 */
241
-	public function register_single_page( Page $page ): void {
241
+	public function register_single_page(Page $page): void {
242 242
 		// Register view if required.
243
-		if ( \method_exists( $page, 'set_view' ) ) {
244
-			$page->set_view( $this->view );
243
+		if (\method_exists($page, 'set_view')) {
244
+			$page->set_view($this->view);
245 245
 		}
246 246
 
247 247
 		try {
248
-			$this->registrar->register_primary( $page, null );
249
-		} catch ( \Throwable $th ) {
250
-			$this->admin_exception_notice( $page, $th );
248
+			$this->registrar->register_primary($page, null);
249
+		} catch (\Throwable $th) {
250
+			$this->admin_exception_notice($page, $th);
251 251
 		}
252 252
 	}
253 253
 }
Please login to merge, or discard this patch.