| Server IP : 213.136.93.164 / Your IP : 216.73.216.104 Web Server : Apache System : Linux m14200.contabo.net 5.14.0-611.54.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed May 6 18:03:03 EDT 2026 x86_64 User : ki692510 ( 1047) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/home/ki692510/www/wp-content/plugins/elementor/core/utils/api/ |
Upload File : |
<?php
namespace Elementor\Core\Utils\Api;
class Response_Builder {
private $data;
private int $status;
private array $meta = [];
const NO_CONTENT = 204;
private function __construct( $data, $status ) {
$this->data = $data;
$this->status = $status;
}
public static function make( $data = null, $status = 200 ) {
return new self( $data, $status );
}
public function set_meta( array $meta ) {
$this->meta = $meta;
return $this;
}
public function set_status( int $status ) {
$this->status = $status;
return $this;
}
public function no_content() {
return $this->set_status( static::NO_CONTENT );
}
public function build() {
$res_data = static::NO_CONTENT === $this->status
? null
: [
'data' => $this->data,
'meta' => $this->meta,
];
return new \WP_REST_Response( $res_data, $this->status );
}
}