Passed
Pull Request — master (#43)
by Glynn
07:58
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/Abstract_Validator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 * @return bool
49 49
 	 */
50 50
 	public function has_errors(): bool {
51
-		return count( $this->errors ) > 0;
51
+		return count($this->errors) > 0;
52 52
 	}
53 53
 
54 54
 	/**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 * @param string $error
67 67
 	 * @return void
68 68
 	 */
69
-	public function push_error( string $error ): void {
69
+	public function push_error(string $error): void {
70 70
 		$this->errors[] = $error;
71 71
 	}
72 72
 
@@ -76,5 +76,5 @@  discard block
 block discarded – undo
76 76
 	 * @param mixed $subject
77 77
 	 * @return bool
78 78
 	 */
79
-	abstract public function validate( $subject): bool;
79
+	abstract public function validate($subject): bool;
80 80
 }
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/Group/Abstract_Group.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 	 * @return string
85 85
 	 */
86 86
 	public function get_group_title(): string {
87
-		if ( $this->group_title === null ) {
88
-			throw Group_Exception::group_title_undefined( $this );
87
+		if ($this->group_title === null) {
88
+			throw Group_Exception::group_title_undefined($this);
89 89
 		}
90 90
 		return $this->group_title;
91 91
 	}
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
 	 * @return string
115 115
 	 */
116 116
 	public function get_primary_page(): string {
117
-		if ( $this->primary_page === null ) {
118
-			throw Group_Exception::primary_page_undefined( $this );
117
+		if ($this->primary_page === null) {
118
+			throw Group_Exception::primary_page_undefined($this);
119 119
 		}
120 120
 		return $this->primary_page;
121 121
 	}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @return void
147 147
 	 * @codeCoverageIgnore This can't be tested as it does nothing and is extended only
148 148
 	 */
149
-	public function enqueue( Abstract_Group $group, Page $page ): void {
149
+	public function enqueue(Abstract_Group $group, Page $page): void {
150 150
 		// Do nothing by default.
151 151
 	}
152 152
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 * @return void
159 159
 	 * @codeCoverageIgnore This can't be tested as it does nothing and is extended only
160 160
 	 */
161
-	public function load( Abstract_Group $group, Page $page ): void {
161
+	public function load(Abstract_Group $group, Page $page): void {
162 162
 		// Do nothing by default.
163 163
 	}
164 164
 }
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_Dispatcher.php 1 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,20 +63,20 @@  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 );
76
+			$this->set_primary_page_details($group);
77 77
 
78
-		} catch ( \Throwable $th ) {
79
-			$this->admin_exception_notice( $group, $th );
78
+		} catch (\Throwable $th) {
79
+			$this->admin_exception_notice($group, $th);
80 80
 		}
81 81
 	}
82 82
 
@@ -87,22 +87,22 @@  discard block
 block discarded – undo
87 87
 	 * @param \Throwable $exception
88 88
 	 * @return void
89 89
 	 */
90
-	public function admin_exception_notice( $object, Throwable $exception ): void {
90
+	public function admin_exception_notice($object, Throwable $exception): void {
91 91
 		add_action(
92 92
 			'admin_notices',
93
-			function() use ( $object, $exception ) {
93
+			function() use ($object, $exception) {
94 94
 				$class   = 'notice notice-error';
95 95
 				$message = sprintf(
96 96
 					'%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>',
97
-					get_class( $object ) === Page::class ? 'Page' : 'Menu Group',
98
-					get_class( $object ),
97
+					get_class($object) === Page::class ? 'Page' : 'Menu Group',
98
+					get_class($object),
99 99
 					$exception->getMessage(),
100 100
 					$exception->getFile(),
101 101
 					$exception->getLine()
102 102
 				);
103 103
 				printf(
104 104
 					'<div class="%1$s"><p>%2$s</p></div>',
105
-					esc_attr( $class ),
105
+					esc_attr($class),
106 106
 					wp_kses(
107 107
 						$message,
108 108
 						array(
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
 	 * @param \PinkCrab\Perique_Admin_Menu\Group\Abstract_Group $group
123 123
 	 * @return void
124 124
 	 */
125
-	protected function register_primary_page( Abstract_Group $group ): void {
125
+	protected function register_primary_page(Abstract_Group $group): void {
126 126
 		$this->registrar->register_primary(
127
-			$this->get_primary_page( $group ),
127
+			$this->get_primary_page($group),
128 128
 			$group
129 129
 		);
130 130
 	}
@@ -135,17 +135,17 @@  discard block
 block discarded – undo
135 135
 	 * @param \PinkCrab\Perique_Admin_Menu\Group\Abstract_Group $group
136 136
 	 * @return \PinkCrab\Perique_Admin_Menu\Page\Page
137 137
 	 */
138
-	protected function get_primary_page( Abstract_Group $group ): Page {
138
+	protected function get_primary_page(Abstract_Group $group): Page {
139 139
 		/** @var Page */
140
-		$page = $this->di_container->create( $group->get_primary_page() );
140
+		$page = $this->di_container->create($group->get_primary_page());
141 141
 
142
-		if ( ! is_object( $page ) || ! is_a( $page, Page::class ) ) {
143
-			throw Page_Exception::invalid_page_type( $page );
142
+		if ( ! is_object($page) || ! is_a($page, Page::class)) {
143
+			throw Page_Exception::invalid_page_type($page);
144 144
 		}
145 145
 
146 146
 		// Register view if requied.
147
-		if ( \method_exists( $page, 'set_view' ) ) {
148
-			$page->set_view( $this->view );
147
+		if (\method_exists($page, 'set_view')) {
148
+			$page->set_view($this->view);
149 149
 		}
150 150
 
151 151
 		return $page;
@@ -159,18 +159,18 @@  discard block
 block discarded – undo
159 159
 	 * @return array<Page>
160 160
 	 * @throws Page_Exception (Code 202)
161 161
 	 */
162
-	protected function get_pages( Abstract_Group $group ): array {
162
+	protected function get_pages(Abstract_Group $group): array {
163 163
 		return array_map(
164
-			function( string $page ): Page {
165
-				$constructed_page = $this->di_container->create( $page );
166
-				if ( ! is_object( $constructed_page ) || ! is_a( $constructed_page, Page::class ) ) {
167
-					throw Page_Exception::invalid_page_type( $constructed_page );
164
+			function(string $page): Page {
165
+				$constructed_page = $this->di_container->create($page);
166
+				if ( ! is_object($constructed_page) || ! is_a($constructed_page, Page::class)) {
167
+					throw Page_Exception::invalid_page_type($constructed_page);
168 168
 				}
169 169
 				return $constructed_page;
170 170
 			},
171 171
 			array_filter(
172 172
 				$group->get_pages(),
173
-				function( string $page ) use ( $group ) {
173
+				function(string $page) use ($group) {
174 174
 					return $page !== $group->get_primary_page();
175 175
 				}
176 176
 			)
@@ -186,22 +186,22 @@  discard block
 block discarded – undo
186 186
 	 * @phpcs:disable WordPress.WP.GlobalVariablesOverride.Prohibited
187 187
 	 * @throws Group_Exception (code 253)
188 188
 	 */
189
-	protected function set_primary_page_details( Abstract_Group $group ) {
189
+	protected function set_primary_page_details(Abstract_Group $group) {
190 190
 		global $submenu;
191 191
 
192
-		$primary = $this->get_primary_page( $group );
192
+		$primary = $this->get_primary_page($group);
193 193
 
194
-		if ( ! array_key_exists( $primary->slug(), $submenu ) ) {
194
+		if ( ! array_key_exists($primary->slug(), $submenu)) {
195 195
 			return;
196 196
 		}
197 197
 
198 198
 		$primary_page_key = array_search(
199 199
 			$primary->slug(),
200
-			\array_column( $submenu[ $primary->slug() ], 2 ),
200
+			\array_column($submenu[$primary->slug()], 2),
201 201
 			true
202 202
 		) ?: 0;
203 203
 
204
-		$submenu[ $primary->slug() ][ $primary_page_key ][0] = $primary->menu_title();
204
+		$submenu[$primary->slug()][$primary_page_key][0] = $primary->menu_title();
205 205
 	}
206 206
 
207 207
 
@@ -213,21 +213,21 @@  discard block
 block discarded – undo
213 213
 	 * @param \PinkCrab\Perique_Admin_Menu\Group\Abstract_Group|null $group
214 214
 	 * @return void
215 215
 	 */
216
-	public function register_subpage( Page $page, string $parent_slug, ?Abstract_Group $group = null ): void {
216
+	public function register_subpage(Page $page, string $parent_slug, ?Abstract_Group $group = null): void {
217 217
 		// If user cant access the page, bail before attempting to register.
218
-		if ( ! current_user_can( $page->capability() ) ) {
218
+		if ( ! current_user_can($page->capability())) {
219 219
 			return;
220 220
 		}
221 221
 
222 222
 		// Register view if required.
223
-		if ( \method_exists( $page, 'set_view' ) ) {
224
-			$page->set_view( $this->view );
223
+		if (\method_exists($page, 'set_view')) {
224
+			$page->set_view($this->view);
225 225
 		}
226 226
 
227 227
 		try {
228
-			$this->registrar->register_subpage( $page, $parent_slug, $group );
229
-		} catch ( \Throwable $th ) {
230
-			$this->admin_exception_notice( $page, $th );
228
+			$this->registrar->register_subpage($page, $parent_slug, $group);
229
+		} catch (\Throwable $th) {
230
+			$this->admin_exception_notice($page, $th);
231 231
 		}
232 232
 	}
233 233
 
@@ -237,16 +237,16 @@  discard block
 block discarded – undo
237 237
 	 * @param \PinkCrab\Perique_Admin_Menu\Page\Page $page
238 238
 	 * @return void
239 239
 	 */
240
-	public function register_single_page( Page $page ): void {
240
+	public function register_single_page(Page $page): void {
241 241
 		// Register view if required.
242
-		if ( \method_exists( $page, 'set_view' ) ) {
243
-			$page->set_view( $this->view );
242
+		if (\method_exists($page, 'set_view')) {
243
+			$page->set_view($this->view);
244 244
 		}
245 245
 
246 246
 		try {
247
-			$this->registrar->register_primary( $page, null );
248
-		} catch ( \Throwable $th ) {
249
-			$this->admin_exception_notice( $page, $th );
247
+			$this->registrar->register_primary($page, null);
248
+		} catch (\Throwable $th) {
249
+			$this->admin_exception_notice($page, $th);
250 250
 		}
251 251
 	}
252 252
 
Please login to merge, or discard this patch.