@@ -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 | ); |
@@ -56,42 +56,42 @@ 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 SUB 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 SINGLE/PARENT page. |
74 | 74 | if ( |
75 | - is_a( $class, Page::class ) |
|
75 | + is_a($class, Page::class) |
|
76 | 76 | && is_admin() |
77 | - && is_null( $class->parent_slug() ) |
|
77 | + && is_null($class->parent_slug()) |
|
78 | 78 | ) { |
79 | 79 | $this->add_to_loader( |
80 | - function () use ( $class ) : void { |
|
81 | - $this->dispatcher->register_single_page( $class ); |
|
80 | + function() use ($class) : void { |
|
81 | + $this->dispatcher->register_single_page($class); |
|
82 | 82 | } |
83 | 83 | ); |
84 | 84 | } |
85 | 85 | |
86 | 86 | // If we have a valid group. |
87 | 87 | if ( |
88 | - is_a( $class, Abstract_Group::class ) |
|
88 | + is_a($class, Abstract_Group::class) |
|
89 | 89 | && is_admin() |
90 | 90 | ) { |
91 | 91 | |
92 | 92 | $this->add_to_loader( |
93 | - function () use ( $class ): void { |
|
94 | - $this->dispatcher->register_group( $class ); |
|
93 | + function() use ($class): void { |
|
94 | + $this->dispatcher->register_group($class); |
|
95 | 95 | } |
96 | 96 | ); |
97 | 97 | } |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @param callable $callback |
105 | 105 | * @return void |
106 | 106 | */ |
107 | - protected function add_to_loader( callable $callback ): void { |
|
108 | - $this->hook_loader->action( 'admin_menu', $callback ); |
|
107 | + protected function add_to_loader(callable $callback): void { |
|
108 | + $this->hook_loader->action('admin_menu', $callback); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 |
@@ -41,9 +41,9 @@ discard block |
||
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 ( get_parent_class( $page ) ) { |
|
46 | + switch (get_parent_class($page)) { |
|
47 | 47 | // For menu pages |
48 | 48 | case Menu_Page::class: |
49 | 49 | $hook = add_menu_page( |
@@ -53,18 +53,18 @@ discard block |
||
53 | 53 | $page->slug(), |
54 | 54 | $page->render_view(), |
55 | 55 | $group ? $group->get_icon() : '', |
56 | - (int) ( $group ? $group->get_position() : $page->position() ) |
|
56 | + (int) ($group ? $group->get_position() : $page->position()) |
|
57 | 57 | ); |
58 | 58 | |
59 | 59 | // Register Enqueue hooks for page/group. |
60 | - $this->enqueue_scripts( $hook, $page, $group ); |
|
60 | + $this->enqueue_scripts($hook, $page, $group); |
|
61 | 61 | // Register hook for pre-load page |
62 | - $this->pre_load_hook( $hook, $page, $group ); |
|
62 | + $this->pre_load_hook($hook, $page, $group); |
|
63 | 63 | |
64 | 64 | break; |
65 | 65 | |
66 | 66 | default: |
67 | - do_action( Hooks::PAGE_REGISTRAR_PRIMARY, $page, $group ); |
|
67 | + do_action(Hooks::PAGE_REGISTRAR_PRIMARY, $page, $group); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | * @param \PinkCrab\Perique_Admin_Menu\Group\Abstract_Group|null $group |
77 | 77 | * @return void |
78 | 78 | */ |
79 | - public function register_subpage( Page $page, string $parent_slug, ?Abstract_Group $group = null ): void { |
|
80 | - switch ( get_parent_class( $page ) ) { |
|
79 | + public function register_subpage(Page $page, string $parent_slug, ?Abstract_Group $group = null): void { |
|
80 | + switch (get_parent_class($page)) { |
|
81 | 81 | case Menu_Page::class: |
82 | 82 | $hook = add_submenu_page( |
83 | 83 | $parent_slug, |
@@ -90,19 +90,19 @@ discard block |
||
90 | 90 | ); |
91 | 91 | |
92 | 92 | // If the sub page cant be registered because of permissions. Then we need to register the page as a primary page. |
93 | - if ( ! is_string( $hook ) ) { |
|
93 | + if ( ! is_string($hook)) { |
|
94 | 94 | return; |
95 | 95 | } |
96 | 96 | |
97 | 97 | // Register Enqueue hooks for page/group. |
98 | - $this->enqueue_scripts( $hook, $page, $group ); |
|
98 | + $this->enqueue_scripts($hook, $page, $group); |
|
99 | 99 | |
100 | 100 | // Register hook for pre-load page |
101 | - $this->pre_load_hook( $hook, $page, $group ); |
|
101 | + $this->pre_load_hook($hook, $page, $group); |
|
102 | 102 | |
103 | 103 | break; |
104 | 104 | default: |
105 | - do_action( Hooks::PAGE_REGISTRAR_SUB, $page, $parent_slug ); |
|
105 | + do_action(Hooks::PAGE_REGISTRAR_SUB, $page, $parent_slug); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | * @param \PinkCrab\Perique_Admin_Menu\Group\Abstract_Group|null $group |
115 | 115 | * @return void |
116 | 116 | */ |
117 | - protected function enqueue_scripts( string $hook, Page $page, ?Abstract_Group $group = null ): void { |
|
118 | - add_action( 'admin_enqueue_scripts', new Page_Enqueue_Action( $hook, $page, $group ) ); |
|
117 | + protected function enqueue_scripts(string $hook, Page $page, ?Abstract_Group $group = null): void { |
|
118 | + add_action('admin_enqueue_scripts', new Page_Enqueue_Action($hook, $page, $group)); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param \PinkCrab\Perique_Admin_Menu\Group\Abstract_Group|null $group |
127 | 127 | * @return void |
128 | 128 | */ |
129 | - protected function pre_load_hook( string $hook, Page $page, ?Abstract_Group $group = null ): void { |
|
130 | - add_action( 'load-' . $hook, new Page_Load_Action( $page, $group ) ); |
|
129 | + protected function pre_load_hook(string $hook, Page $page, ?Abstract_Group $group = null): void { |
|
130 | + add_action('load-' . $hook, new Page_Load_Action($page, $group)); |
|
131 | 131 | } |
132 | 132 | } |
@@ -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(), $group ); |
|
78 | + foreach ($this->get_pages($group) as $page) { |
|
79 | + $this->register_subpage($page, $this->get_primary_page($group)->slug(), $group); |
|
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 | |
@@ -218,21 +218,21 @@ discard block |
||
218 | 218 | * @param \PinkCrab\Perique_Admin_Menu\Group\Abstract_Group|null $group |
219 | 219 | * @return void |
220 | 220 | */ |
221 | - public function register_subpage( Page $page, string $parent_slug, ?Abstract_Group $group = null ): void { |
|
221 | + public function register_subpage(Page $page, string $parent_slug, ?Abstract_Group $group = null): void { |
|
222 | 222 | // If user cant access the page, bail before attempting to register. |
223 | - if ( ! current_user_can( $page->capability() ) ) { |
|
223 | + if ( ! current_user_can($page->capability())) { |
|
224 | 224 | return; |
225 | 225 | } |
226 | 226 | |
227 | 227 | // Register view if required. |
228 | - if ( \method_exists( $page, 'set_view' ) ) { |
|
229 | - $page->set_view( $this->view ); |
|
228 | + if (\method_exists($page, 'set_view')) { |
|
229 | + $page->set_view($this->view); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | try { |
233 | - $this->registrar->register_subpage( $page, $parent_slug, $group ); |
|
234 | - } catch ( \Throwable $th ) { |
|
235 | - $this->admin_exception_notice( $page, $th ); |
|
233 | + $this->registrar->register_subpage($page, $parent_slug, $group); |
|
234 | + } catch (\Throwable $th) { |
|
235 | + $this->admin_exception_notice($page, $th); |
|
236 | 236 | } |
237 | 237 | } |
238 | 238 | |
@@ -242,16 +242,16 @@ discard block |
||
242 | 242 | * @param \PinkCrab\Perique_Admin_Menu\Page\Page $page |
243 | 243 | * @return void |
244 | 244 | */ |
245 | - public function register_single_page( Page $page ): void { |
|
245 | + public function register_single_page(Page $page): void { |
|
246 | 246 | // Register view if required. |
247 | - if ( \method_exists( $page, 'set_view' ) ) { |
|
248 | - $page->set_view( $this->view ); |
|
247 | + if (\method_exists($page, 'set_view')) { |
|
248 | + $page->set_view($this->view); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | try { |
252 | - $this->registrar->register_primary( $page, null ); |
|
253 | - } catch ( \Throwable $th ) { |
|
254 | - $this->admin_exception_notice( $page, $th ); |
|
252 | + $this->registrar->register_primary($page, null); |
|
253 | + } catch (\Throwable $th) { |
|
254 | + $this->admin_exception_notice($page, $th); |
|
255 | 255 | } |
256 | 256 | } |
257 | 257 |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | protected $group; |
46 | 46 | |
47 | - public function __construct( Page $page, ?Abstract_Group $group = null ) { |
|
47 | + public function __construct(Page $page, ?Abstract_Group $group = null) { |
|
48 | 48 | $this->page = $page; |
49 | 49 | $this->group = $group; |
50 | 50 | } |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function __invoke() { |
58 | 58 | // Register hooks for the group if part of group |
59 | - if ( null !== $this->group ) { |
|
60 | - $this->group->load( $this->group, $this->page ); |
|
59 | + if (null !== $this->group) { |
|
60 | + $this->group->load($this->group, $this->page); |
|
61 | 61 | } |
62 | 62 | |
63 | - $this->page->load( $this->page ); |
|
63 | + $this->page->load($this->page); |
|
64 | 64 | } |
65 | 65 | } |
@@ -84,8 +84,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -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 ( null === $this->view ) { |
|
164 | - throw Page_Exception::view_not_set( $this ); |
|
163 | + if (null === $this->view) { |
|
164 | + throw Page_Exception::view_not_set($this); |
|
165 | 165 | } |
166 | 166 | |
167 | - if ( null === $this->view_template ) { |
|
168 | - throw Page_Exception::undefined_property( 'view_template', $this ); |
|
167 | + if (null === $this->view_template) { |
|
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 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @return void |
182 | 182 | * @codeCoverageIgnore This can be tested as it does nothing and is extended only |
183 | 183 | */ |
184 | - public function enqueue( Page $page ): void { |
|
184 | + public function enqueue(Page $page): void { |
|
185 | 185 | // Do nothing. |
186 | 186 | // Can be extended in any child class that extends. |
187 | 187 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * @return void |
194 | 194 | * @codeCoverageIgnore This can be tested as it does nothing and is extended only |
195 | 195 | */ |
196 | - public function load( Page $page ): void { |
|
196 | + public function load(Page $page): void { |
|
197 | 197 | // Do nothing. |
198 | 198 | // Can be extended in any child class that extends. |
199 | 199 | } |
@@ -58,12 +58,12 @@ |
||
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 | } |