| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 2 | 3 | namespace Elementor\Data; |
| 3 | 4 | |
| 4 | 5 | use Elementor\Core\Base\Module as BaseModule; |
| 5 | 6 | use Elementor\Data\Base\Processor; |
| @@ -4,9 +5,9 @@ | ||
| 4 | 5 | use Elementor\Core\Base\Module as BaseModule; |
| 5 | 6 | use Elementor\Data\Base\Processor; |
| 6 | 7 | |
| 7 | 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 8 | - exit; // Exit if accessed directly. | |
| 9 | + exit; // Exit if accessed directly | |
| 9 | 10 | } |
| 10 | 11 | |
| 11 | 12 | class Manager extends BaseModule { |
| 12 | 13 | |
| @@ -109,8 +110,9 @@ | ||
| 109 | 110 | * Register endpoint format. |
| 110 | 111 | * |
| 111 | 112 | * @param string $command |
| 112 | 113 | * @param string $format |
| 114 | + * | |
| 113 | 115 | */ |
| 114 | 116 | public function register_endpoint_format( $command, $format ) { |
| 115 | 117 | $this->command_formats[ $command ] = rtrim( $format, '/' ); |
| 116 | 118 | } |
| @@ -115,11 +117,15 @@ | ||
| 115 | 117 | $this->command_formats[ $command ] = rtrim( $format, '/' ); |
| 116 | 118 | } |
| 117 | 119 | |
| 118 | 120 | public function register_rest_error_handler() { |
| 121 | + // TODO: Remove - Find better solution. | |
| 122 | + return; | |
| 123 | + | |
| 119 | 124 | if ( ! $this->is_internal() ) { |
| 120 | 125 | $logger_manager = \Elementor\Core\Logger\Manager::instance(); |
| 121 | - $logger_manager->register_error_handler(); | |
| 126 | + | |
| 127 | + set_error_handler( [ $logger_manager, 'rest_error_handler' ], E_ALL ); | |
| 122 | 128 | } |
| 123 | 129 | } |
| 124 | 130 | |
| 125 | 131 | /** |
| @@ -153,9 +159,9 @@ | ||
| 153 | 159 | /** |
| 154 | 160 | * Command extract args. |
| 155 | 161 | * |
| 156 | 162 | * @param string $command |
| 157 | - * @param array $args | |
| 163 | + * @param array $args | |
| 158 | 164 | * |
| 159 | 165 | * @return \stdClass |
| 160 | 166 | */ |
| 161 | 167 | public function command_extract_args( $command, $args = [] ) { |
| @@ -261,10 +267,10 @@ | ||
| 261 | 267 | |
| 262 | 268 | /** |
| 263 | 269 | * Run processor. |
| 264 | 270 | * |
| 265 | - * @param Processor $processor | |
| 266 | - * @param array $data | |
| 271 | + * @param \Elementor\Data\Base\Processor $processor | |
| 272 | + * @param array $data | |
| 267 | 273 | * |
| 268 | 274 | * @return mixed |
| 269 | 275 | */ |
| 270 | 276 | public function run_processor( $processor, $data ) { |
| @@ -279,11 +285,11 @@ | ||
| 279 | 285 | * Run processors. |
| 280 | 286 | * |
| 281 | 287 | * Filter them by class. |
| 282 | 288 | * |
| 283 | - * @param Processor[] $processors | |
| 284 | - * @param string $filter_by_class | |
| 285 | - * @param array $data | |
| 289 | + * @param \Elementor\Data\Base\Processor[] $processors | |
| 290 | + * @param string $filter_by_class | |
| 291 | + * @param array $data | |
| 286 | 292 | * |
| 287 | 293 | * @return false|array |
| 288 | 294 | */ |
| 289 | 295 | public function run_processors( $processors, $filter_by_class, $data ) { |
| @@ -312,9 +318,9 @@ | ||
| 312 | 318 | * Simulate rest API from within the backend. |
| 313 | 319 | * Use args as query. |
| 314 | 320 | * |
| 315 | 321 | * @param string $endpoint |
| 316 | - * @param array $args | |
| 322 | + * @param array $args | |
| 317 | 323 | * @param string $method |
| 318 | 324 | * |
| 319 | 325 | * @return \WP_REST_Response |
| 320 | 326 | */ |
| @@ -340,9 +346,9 @@ | ||
| 340 | 346 | * |
| 341 | 347 | * Wrapper for `$this->run_request` return `$response->getData()` instead of `$response`. |
| 342 | 348 | * |
| 343 | 349 | * @param string $endpoint |
| 344 | - * @param array $args | |
| 350 | + * @param array $args | |
| 345 | 351 | * @param string $method |
| 346 | 352 | * |
| 347 | 353 | * @return array |
| 348 | 354 | */ |