Files
espocrm/install/core/PostData.php
2019-12-05 16:26:11 +02:00

46 lines
781 B
PHP

<?php
class PostData
{
protected $data = [];
public function __construct()
{
$this->init();
}
protected function init()
{
if (isset($_POST) && is_array($_POST)) {
$this->data = $_POST;
}
}
public function set($name, $value = null)
{
if (!is_array($name)) {
$name = [
$name => $value
];
}
foreach ($name as $key => $value) {
$this->data[$key] = $value;
}
}
public function get($name, $default = null)
{
if (array_key_exists($name, $this->data)) {
return $this->data[$name];
}
return $default;
}
public function getAll()
{
return $this->data;
}
}