@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | * @param \PinkCrab\Ajax\Ajax $ajax_class |
65 | 65 | * @return bool |
66 | 66 | */ |
67 | - public function validate_request( Ajax $ajax_class ): bool { |
|
68 | - return $this->request_validator->validate( $ajax_class ); |
|
67 | + public function validate_request(Ajax $ajax_class): bool { |
|
68 | + return $this->request_validator->validate($ajax_class); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | * @return \Psr\Http\Message\ResponseInterface |
76 | 76 | * @filter Ajax_Hooks::CALLBACK_REQUEST_FILTER |
77 | 77 | */ |
78 | - public function invoke_callback( Ajax $ajax_class ): ResponseInterface { |
|
78 | + public function invoke_callback(Ajax $ajax_class): ResponseInterface { |
|
79 | 79 | return $ajax_class->callback( |
80 | - \apply_filters( Ajax_Hooks::CALLBACK_REQUEST_FILTER, $this->server_request, $ajax_class ), |
|
80 | + \apply_filters(Ajax_Hooks::CALLBACK_REQUEST_FILTER, $this->server_request, $ajax_class), |
|
81 | 81 | $this->response_factory |
82 | 82 | ); |
83 | 83 | } |
@@ -91,32 +91,32 @@ discard block |
||
91 | 91 | * @action Ajax_Hooks::CALLBACK_EXECUTION_EXCEPTION |
92 | 92 | * @filter Ajax_Hooks::CALLBACK_RESPONSE_FILTER |
93 | 93 | */ |
94 | - public function create_callback( Ajax $ajax_class ): Closure { |
|
94 | + public function create_callback(Ajax $ajax_class): Closure { |
|
95 | 95 | /** |
96 | 96 | * @param \PinkCrab\Ajax\Ajax $ajax_class |
97 | 97 | * @return noreturn |
98 | 98 | */ |
99 | - return function() use ( $ajax_class ): void { |
|
99 | + return function() use ($ajax_class): void { |
|
100 | 100 | |
101 | 101 | $valid_nonce = apply_filters( |
102 | 102 | Ajax_Hooks::REQUEST_NONCE_VERIFICATION, |
103 | - $this->validate_request( $ajax_class ), |
|
103 | + $this->validate_request($ajax_class), |
|
104 | 104 | $ajax_class, |
105 | 105 | $this->server_request |
106 | 106 | ); |
107 | 107 | |
108 | 108 | try { |
109 | 109 | $response = $valid_nonce |
110 | - ? $this->invoke_callback( $ajax_class ) |
|
110 | + ? $this->invoke_callback($ajax_class) |
|
111 | 111 | : $this->response_factory->unauthorised(); |
112 | - } catch ( Exception $th ) { |
|
112 | + } catch (Exception $th) { |
|
113 | 113 | |
114 | - do_action( Ajax_Hooks::CALLBACK_EXECUTION_EXCEPTION, $th, $ajax_class ); |
|
114 | + do_action(Ajax_Hooks::CALLBACK_EXECUTION_EXCEPTION, $th, $ajax_class); |
|
115 | 115 | |
116 | - $response = $this->response_factory->failure( array( 'error' => $th->getMessage() ) ); |
|
116 | + $response = $this->response_factory->failure(array('error' => $th->getMessage())); |
|
117 | 117 | } |
118 | 118 | $this->http_helper->emit_psr7_response( |
119 | - \apply_filters( Ajax_Hooks::CALLBACK_RESPONSE_FILTER, $response, $ajax_class, $this->server_request ) |
|
119 | + \apply_filters(Ajax_Hooks::CALLBACK_RESPONSE_FILTER, $response, $ajax_class, $this->server_request) |
|
120 | 120 | ); |
121 | 121 | |
122 | 122 | \wp_die(); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | /** @var Ajax_Dispatcher */ |
24 | 24 | public $dispatcher; |
25 | 25 | |
26 | - public function __construct( Ajax_Dispatcher $dispatcher ) { |
|
26 | + public function __construct(Ajax_Dispatcher $dispatcher) { |
|
27 | 27 | $this->dispatcher = $dispatcher; |
28 | 28 | } |
29 | 29 | |
@@ -33,12 +33,12 @@ discard block |
||
33 | 33 | * @param object $class |
34 | 34 | * @return object |
35 | 35 | */ |
36 | - public function process( $class ) { |
|
37 | - if ( is_a( $class, Ajax::class ) |
|
36 | + public function process($class) { |
|
37 | + if (is_a($class, Ajax::class) |
|
38 | 38 | && is_admin() |
39 | 39 | && wp_doing_ajax() |
40 | 40 | ) { |
41 | - $this->dispatcher->add_ajax_call( $class ); |
|
41 | + $this->dispatcher->add_ajax_call($class); |
|
42 | 42 | } |
43 | 43 | return $class; |
44 | 44 | } |