PluginProbe
Elementor Website Builder – more than just a page builder / 4.2.1
Elementor Website Builder – more than just a page builder v4.2.1
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / core / utils / api / error-builder.php

error-builder.php in Elementor Website Builder – more than just a page builder 4.2.1, at core/utils/api/error-builder.php

47 lines 840 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Elementor\Core\Utils\Api;
4
5 class Error_Builder {
6 private string $message;
7 private int $status;
8 private string $code;
9 private array $meta;
10
11 private function __construct( $code, $status = 500 ) {
12 $this->code = $code;
13 $this->status = $status;
14 $this->message = '';
15 $this->meta = [];
16 }
17
18 public static function make( $code, $status = 500 ) {
19 return new self( $code, $status );
20 }
21
22 public function set_status( int $status ) {
23 $this->status = $status;
24
25 return $this;
26 }
27
28 public function set_message( string $message ) {
29 $this->message = $message;
30
31 return $this;
32 }
33
34 public function set_meta( array $meta ) {
35 $this->meta = $meta;
36
37 return $this;
38 }
39
40 public function build() {
41 return new \WP_Error( $this->code, $this->message, [
42 'status' => $this->status,
43 'meta' => $this->meta,
44 ], );
45 }
46 }
47