Archived
1
0
Fork 0
This repository has been archived on 2026-04-03. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
httpcb/app/models/Data/Request.php
2023-04-30 16:57:42 +02:00

93 lines
1.5 KiB
PHP

<?php
namespace App\Model\Data;
use Phalcon\Mvc\Model;
class Request extends Model
{
protected $id;
protected $headers = array();
/**
* @var string|null
*/
protected $body;
public function initialize()
{
$this->useDynamicUpdate(true);
$this->setSource('request_object');
}
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @param mixed $id
* @return Request
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* @return array
*/
public function getHeaders()
{
return $this->headers;
}
/**
* @param array $headers
* @return Request
*/
public function setHeaders($headers)
{
foreach ($headers as $k => $v) {
if (strlen($v) < 1) {
unset($headers[$k]);
}
}
$this->headers = $headers;
return $this;
}
/**
* @return mixed
*/
public function getBody()
{
return $this->body;
}
/**
* @param mixed $body
* @return Request
*/
public function setBody($body)
{
$this->body = $body;
return $this;
}
public function afterFetch()
{
$this->headers = json_decode($this->headers, true);
}
public function beforeSave()
{
$this->headers = json_encode($this->headers);
}
}