PluginProbe
Elementor Website Builder – more than just a page builder / 3.30.2
Elementor Website Builder – more than just a page builder v3.30.2
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 / modules / global-classes / utils / error-builder.php

error-builder.php in Elementor Website Builder – more than just a page builder 3.30.2, at modules/global-classes/utils/error-builder.php

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