@@ -37,11 +37,11 @@ discard block |
||
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 |
||
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 |
||
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 | ); |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | * @return self |
91 | 91 | * @code 202 |
92 | 92 | */ |
93 | - public static function acf_not_active( Page $page ): self { |
|
93 | + public static function acf_not_active(Page $page): self { |
|
94 | 94 | return new self( |
95 | 95 | sprintf( |
96 | 96 | '%s can not be registered as ACF is not currently active.', |
97 | - get_class( $page ) |
|
97 | + get_class($page) |
|
98 | 98 | ), |
99 | 99 | 203 |
100 | 100 | ); |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | * @return self |
108 | 108 | * @code 204 |
109 | 109 | */ |
110 | - public static function failed_to_register_page( Page $page ) { |
|
110 | + public static function failed_to_register_page(Page $page) { |
|
111 | 111 | return new self( |
112 | 112 | sprintf( |
113 | 113 | '%s could not be registered', |
114 | - get_class( $page ) |
|
114 | + get_class($page) |
|
115 | 115 | ), |
116 | 116 | 204 |
117 | 117 | ); |
@@ -38,11 +38,11 @@ discard block |
||
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 |
||
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 |
||
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 | ); |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | * @return string |
81 | 81 | */ |
82 | 82 | public function get_group_title(): string { |
83 | - if ( $this->group_title === null ) { |
|
84 | - throw Group_Exception::group_title_undefined( $this ); |
|
83 | + if ($this->group_title === null) { |
|
84 | + throw Group_Exception::group_title_undefined($this); |
|
85 | 85 | } |
86 | 86 | return $this->group_title; |
87 | 87 | } |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | * @return string |
111 | 111 | */ |
112 | 112 | public function get_primary_page(): string { |
113 | - if ( $this->primary_page === null ) { |
|
114 | - throw Group_Exception::primary_page_undefined( $this ); |
|
113 | + if ($this->primary_page === null) { |
|
114 | + throw Group_Exception::primary_page_undefined($this); |
|
115 | 115 | } |
116 | 116 | return $this->primary_page; |
117 | 117 | } |
@@ -56,29 +56,29 @@ discard block |
||
56 | 56 | * @param object $class |
57 | 57 | * @return object |
58 | 58 | */ |
59 | - public function process( $class ) { |
|
59 | + public function process($class) { |
|
60 | 60 | // If we have a valid page. |
61 | 61 | if ( |
62 | - is_a( $class, Page::class ) |
|
62 | + is_a($class, Page::class) |
|
63 | 63 | && is_admin() |
64 | - && ! is_null( $class->parent_slug() ) |
|
64 | + && ! is_null($class->parent_slug()) |
|
65 | 65 | ) { |
66 | 66 | $this->add_to_loader( |
67 | - function () use ( $class ) : void { |
|
68 | - $this->dispatcher->register_subpage( $class, $class->parent_slug() ); |
|
67 | + function() use ($class) : void { |
|
68 | + $this->dispatcher->register_subpage($class, $class->parent_slug()); |
|
69 | 69 | } |
70 | 70 | ); |
71 | 71 | } |
72 | 72 | |
73 | 73 | // If we have a valid group. |
74 | 74 | if ( |
75 | - is_a( $class, Abstract_Group::class ) |
|
75 | + is_a($class, Abstract_Group::class) |
|
76 | 76 | && is_admin() |
77 | 77 | ) { |
78 | 78 | |
79 | 79 | $this->add_to_loader( |
80 | - function () use ( $class ): void { |
|
81 | - $this->dispatcher->register_group( $class ); |
|
80 | + function() use ($class): void { |
|
81 | + $this->dispatcher->register_group($class); |
|
82 | 82 | } |
83 | 83 | ); |
84 | 84 | } |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | * @param callable $callback |
92 | 92 | * @return void |
93 | 93 | */ |
94 | - protected function add_to_loader( callable $callback ): void { |
|
95 | - $this->hook_loader->action( 'admin_menu', $callback ); |
|
94 | + protected function add_to_loader(callable $callback): void { |
|
95 | + $this->hook_loader->action('admin_menu', $callback); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | /** @var \PinkCrab\Perique_Admin_Menu\Registrar\Registrar */ |
46 | 46 | protected $registrar; |
47 | 47 | |
48 | - public function __construct( DI_Container $di_container, View $view, Registrar $registrar ) { |
|
48 | + public function __construct(DI_Container $di_container, View $view, Registrar $registrar) { |
|
49 | 49 | $this->di_container = $di_container; |
50 | 50 | $this->view = $view; |
51 | 51 | $this->registrar = $registrar; |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | * @param \PinkCrab\Perique_Admin_Menu\Group\Abstract_Group $group |
58 | 58 | * @return void |
59 | 59 | */ |
60 | - public function register_group( Abstract_Group $group ): void { |
|
60 | + public function register_group(Abstract_Group $group): void { |
|
61 | 61 | |
62 | 62 | // If current user can not access the group, bail without attempting to register. |
63 | - if ( ! current_user_can( $group->get_capability() ) ) { |
|
63 | + if ( ! current_user_can($group->get_capability())) { |
|
64 | 64 | return; |
65 | 65 | } |
66 | 66 | |
@@ -68,20 +68,20 @@ discard block |
||
68 | 68 | |
69 | 69 | // Validate the group. |
70 | 70 | $validator = new Group_Validator(); |
71 | - if ( ! $validator->validate( $group ) ) { |
|
72 | - throw Group_Exception::failed_validation( $validator, $group ); |
|
71 | + if ( ! $validator->validate($group)) { |
|
72 | + throw Group_Exception::failed_validation($validator, $group); |
|
73 | 73 | } |
74 | 74 | |
75 | - $this->register_primary_page( $group ); |
|
75 | + $this->register_primary_page($group); |
|
76 | 76 | |
77 | 77 | // Register all pages and attempt to set primary page name in menu. |
78 | - foreach ( $this->get_pages( $group ) as $page ) { |
|
79 | - $this->register_subpage( $page, $this->get_primary_page( $group )->slug() ); |
|
78 | + foreach ($this->get_pages($group) as $page) { |
|
79 | + $this->register_subpage($page, $this->get_primary_page($group)->slug()); |
|
80 | 80 | } |
81 | - $this->set_primary_page_details( $group ); |
|
81 | + $this->set_primary_page_details($group); |
|
82 | 82 | |
83 | - } catch ( \Throwable $th ) { |
|
84 | - $this->admin_exception_notice( $group, $th ); |
|
83 | + } catch (\Throwable $th) { |
|
84 | + $this->admin_exception_notice($group, $th); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
@@ -92,22 +92,22 @@ discard block |
||
92 | 92 | * @param \Throwable $exception |
93 | 93 | * @return void |
94 | 94 | */ |
95 | - public function admin_exception_notice( $object, Throwable $exception ): void { |
|
95 | + public function admin_exception_notice($object, Throwable $exception): void { |
|
96 | 96 | add_action( |
97 | 97 | 'admin_notices', |
98 | - function() use ( $object, $exception ) { |
|
98 | + function() use ($object, $exception) { |
|
99 | 99 | $class = 'notice notice-error'; |
100 | 100 | $message = sprintf( |
101 | 101 | '%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>', |
102 | - get_class( $object ) === Page::class ? 'Page' : 'Menu Group', |
|
103 | - get_class( $object ), |
|
102 | + get_class($object) === Page::class ? 'Page' : 'Menu Group', |
|
103 | + get_class($object), |
|
104 | 104 | $exception->getMessage(), |
105 | 105 | $exception->getFile(), |
106 | 106 | $exception->getLine() |
107 | 107 | ); |
108 | 108 | printf( |
109 | 109 | '<div class="%1$s"><p>%2$s</p></div>', |
110 | - esc_attr( $class ), |
|
110 | + esc_attr($class), |
|
111 | 111 | wp_kses( |
112 | 112 | $message, |
113 | 113 | array( |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | * @param \PinkCrab\Perique_Admin_Menu\Group\Abstract_Group $group |
128 | 128 | * @return void |
129 | 129 | */ |
130 | - protected function register_primary_page( Abstract_Group $group ): void { |
|
130 | + protected function register_primary_page(Abstract_Group $group): void { |
|
131 | 131 | $this->registrar->register_primary( |
132 | - $this->get_primary_page( $group ), |
|
132 | + $this->get_primary_page($group), |
|
133 | 133 | $group |
134 | 134 | ); |
135 | 135 | } |
@@ -140,17 +140,17 @@ discard block |
||
140 | 140 | * @param \PinkCrab\Perique_Admin_Menu\Group\Abstract_Group $group |
141 | 141 | * @return \PinkCrab\Perique_Admin_Menu\Page\Page |
142 | 142 | */ |
143 | - protected function get_primary_page( Abstract_Group $group ): Page { |
|
143 | + protected function get_primary_page(Abstract_Group $group): Page { |
|
144 | 144 | /** @var Page */ |
145 | - $page = $this->di_container->create( $group->get_primary_page() ); |
|
145 | + $page = $this->di_container->create($group->get_primary_page()); |
|
146 | 146 | |
147 | - if ( ! is_object( $page ) || ! is_a( $page, Page::class ) ) { |
|
148 | - throw Page_Exception::invalid_page_type( $page ); |
|
147 | + if ( ! is_object($page) || ! is_a($page, Page::class)) { |
|
148 | + throw Page_Exception::invalid_page_type($page); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | // Register view if requied. |
152 | - if ( \method_exists( $page, 'set_view' ) ) { |
|
153 | - $page->set_view( $this->view ); |
|
152 | + if (\method_exists($page, 'set_view')) { |
|
153 | + $page->set_view($this->view); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | return $page; |
@@ -164,18 +164,18 @@ discard block |
||
164 | 164 | * @return array<Page> |
165 | 165 | * @throws Page_Exception (Code 202) |
166 | 166 | */ |
167 | - protected function get_pages( Abstract_Group $group ): array { |
|
167 | + protected function get_pages(Abstract_Group $group): array { |
|
168 | 168 | return array_map( |
169 | - function( string $page ): Page { |
|
170 | - $constructed_page = $this->di_container->create( $page ); |
|
171 | - if ( ! is_object( $constructed_page ) || ! is_a( $constructed_page, Page::class ) ) { |
|
172 | - throw Page_Exception::invalid_page_type( $constructed_page ); |
|
169 | + function(string $page): Page { |
|
170 | + $constructed_page = $this->di_container->create($page); |
|
171 | + if ( ! is_object($constructed_page) || ! is_a($constructed_page, Page::class)) { |
|
172 | + throw Page_Exception::invalid_page_type($constructed_page); |
|
173 | 173 | } |
174 | 174 | return $constructed_page; |
175 | 175 | }, |
176 | 176 | array_filter( |
177 | 177 | $group->get_pages(), |
178 | - function( string $page ) use ( $group ) { |
|
178 | + function(string $page) use ($group) { |
|
179 | 179 | return $page !== $group->get_primary_page(); |
180 | 180 | } |
181 | 181 | ) |
@@ -191,22 +191,22 @@ discard block |
||
191 | 191 | * @phpcs:disable WordPress.WP.GlobalVariablesOverride.Prohibited |
192 | 192 | * @throws Group_Exception (code 253) |
193 | 193 | */ |
194 | - protected function set_primary_page_details( Abstract_Group $group ) { |
|
194 | + protected function set_primary_page_details(Abstract_Group $group) { |
|
195 | 195 | global $submenu; |
196 | 196 | |
197 | - $primary = $this->get_primary_page( $group ); |
|
197 | + $primary = $this->get_primary_page($group); |
|
198 | 198 | |
199 | - if ( ! array_key_exists( $primary->slug(), $submenu ) ) { |
|
199 | + if ( ! array_key_exists($primary->slug(), $submenu)) { |
|
200 | 200 | return; |
201 | 201 | } |
202 | 202 | |
203 | 203 | $primary_page_key = array_search( |
204 | 204 | $primary->slug(), |
205 | - \array_column( $submenu[ $primary->slug() ], 2 ), |
|
205 | + \array_column($submenu[$primary->slug()], 2), |
|
206 | 206 | true |
207 | 207 | ) ?: 0; |
208 | 208 | |
209 | - $submenu[ $primary->slug() ][ $primary_page_key ][0] = $primary->menu_title(); |
|
209 | + $submenu[$primary->slug()][$primary_page_key][0] = $primary->menu_title(); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | |
@@ -217,21 +217,21 @@ discard block |
||
217 | 217 | * @param string $parent_slug |
218 | 218 | * @return void |
219 | 219 | */ |
220 | - public function register_subpage( Page $page, string $parent_slug ): void { |
|
220 | + public function register_subpage(Page $page, string $parent_slug): void { |
|
221 | 221 | // If user cant access the page, bail before attemptin to register. |
222 | - if ( ! current_user_can( $page->capability() ) ) { |
|
222 | + if ( ! current_user_can($page->capability())) { |
|
223 | 223 | return; |
224 | 224 | } |
225 | 225 | |
226 | 226 | // Register view if requied. |
227 | - if ( \method_exists( $page, 'set_view' ) ) { |
|
228 | - $page->set_view( $this->view ); |
|
227 | + if (\method_exists($page, 'set_view')) { |
|
228 | + $page->set_view($this->view); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | try { |
232 | - $this->registrar->register_subpage( $page, $parent_slug ); |
|
233 | - } catch ( \Throwable $th ) { |
|
234 | - $this->admin_exception_notice( $page, $th ); |
|
232 | + $this->registrar->register_subpage($page, $parent_slug); |
|
233 | + } catch (\Throwable $th) { |
|
234 | + $this->admin_exception_notice($page, $th); |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | * @throws Page_Exception (Code 204) |
43 | 43 | * @throws TypeError |
44 | 44 | */ |
45 | - public function register_primary( Page $page, Abstract_Group $group = null ): void { |
|
45 | + public function register_primary(Page $page, Abstract_Group $group = null): void { |
|
46 | 46 | |
47 | - switch ( get_parent_class( $page ) ) { |
|
47 | + switch (get_parent_class($page)) { |
|
48 | 48 | // For menu pages |
49 | 49 | case Menu_Page::class: |
50 | - if ( $group === null ) { |
|
51 | - throw new TypeError( 'Valid group must be passed to create Menu_Page' ); |
|
50 | + if ($group === null) { |
|
51 | + throw new TypeError('Valid group must be passed to create Menu_Page'); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | $result = add_menu_page( |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | ); |
63 | 63 | |
64 | 64 | // Call failed action for logging etc. |
65 | - if ( ! is_string( $result ) ) { |
|
66 | - throw Page_Exception::failed_to_register_page( $page ); |
|
65 | + if ( ! is_string($result)) { |
|
66 | + throw Page_Exception::failed_to_register_page($page); |
|
67 | 67 | } |
68 | 68 | break; |
69 | 69 | |
70 | 70 | default: |
71 | - do_action( Hooks::PAGE_REGISTRAR_PRIMARY, $page, $group ); |
|
71 | + do_action(Hooks::PAGE_REGISTRAR_PRIMARY, $page, $group); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | * @return void |
81 | 81 | * @throws Page_Exception (Code 204) |
82 | 82 | */ |
83 | - public function register_subpage( Page $page, string $parent_slug ): void { |
|
84 | - switch ( get_parent_class( $page ) ) { |
|
83 | + public function register_subpage(Page $page, string $parent_slug): void { |
|
84 | + switch (get_parent_class($page)) { |
|
85 | 85 | case Menu_Page::class: |
86 | 86 | $hook = add_submenu_page( |
87 | 87 | $parent_slug, |
@@ -93,12 +93,12 @@ discard block |
||
93 | 93 | $page->position() |
94 | 94 | ); |
95 | 95 | |
96 | - if ( ! is_string( $hook ) ) { |
|
97 | - throw Page_Exception::failed_to_register_page( $page ); |
|
96 | + if ( ! is_string($hook)) { |
|
97 | + throw Page_Exception::failed_to_register_page($page); |
|
98 | 98 | } |
99 | 99 | break; |
100 | 100 | default: |
101 | - do_action( Hooks::PAGE_REGISTRAR_SUB, $page, $parent_slug ); |
|
101 | + do_action(Hooks::PAGE_REGISTRAR_SUB, $page, $parent_slug); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param View $view View |
100 | 100 | * @return self |
101 | 101 | */ |
102 | - public function set_view( View $view ): self { |
|
102 | + public function set_view(View $view): self { |
|
103 | 103 | $this->view = $view; |
104 | 104 | return $this; |
105 | 105 | } |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | * @return string |
116 | 116 | */ |
117 | 117 | public function slug(): string { |
118 | - if ( $this->page_slug === null ) { |
|
119 | - throw Page_Exception::undefined_property( 'page_slug', $this ); |
|
118 | + if ($this->page_slug === null) { |
|
119 | + throw Page_Exception::undefined_property('page_slug', $this); |
|
120 | 120 | } |
121 | 121 | return $this->page_slug; |
122 | 122 | } |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | * @return string |
126 | 126 | */ |
127 | 127 | public function menu_title(): string { |
128 | - if ( $this->menu_title === null ) { |
|
129 | - throw Page_Exception::undefined_property( 'menu_title', $this ); |
|
128 | + if ($this->menu_title === null) { |
|
129 | + throw Page_Exception::undefined_property('menu_title', $this); |
|
130 | 130 | } |
131 | 131 | return $this->menu_title; |
132 | 132 | } |
@@ -160,16 +160,16 @@ discard block |
||
160 | 160 | * @throws Page_Exception code 201 if template not defined. |
161 | 161 | */ |
162 | 162 | public function render_view(): callable { |
163 | - if ( $this->view === null ) { |
|
164 | - throw Page_Exception::view_not_set( $this ); |
|
163 | + if ($this->view === null) { |
|
164 | + throw Page_Exception::view_not_set($this); |
|
165 | 165 | } |
166 | 166 | |
167 | - if ( $this->view_template === null ) { |
|
168 | - throw Page_Exception::undefined_property( 'view_template', $this ); |
|
167 | + if ($this->view_template === null) { |
|
168 | + throw Page_Exception::undefined_property('view_template', $this); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | return function() { |
172 | - $this->view->render( $this->view_template, $this->view_data ); |
|
172 | + $this->view->render($this->view_template, $this->view_data); |
|
173 | 173 | }; |
174 | 174 | |
175 | 175 | } |
@@ -27,10 +27,10 @@ |
||
27 | 27 | abstract class Abstract_Validator { |
28 | 28 | |
29 | 29 | /** |
30 | - * Holds any errors encounted when validation a group. |
|
31 | - * |
|
32 | - * @var array<string> |
|
33 | - */ |
|
30 | + * Holds any errors encounted when validation a group. |
|
31 | + * |
|
32 | + * @var array<string> |
|
33 | + */ |
|
34 | 34 | protected $errors = array(); |
35 | 35 | |
36 | 36 | /** |
@@ -48,7 +48,7 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -35,15 +35,15 @@ discard block |
||
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 |
||
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; |