user edit form

This commit is contained in:
2018-07-22 23:08:16 +02:00
parent ddb885b4e2
commit 1c6dedbb34
29 changed files with 730 additions and 395 deletions
+48 -3
View File
@@ -65,7 +65,8 @@ function unless($cond, $then, $else = '')
* - Undefined keys are returned as null.
* - array and object values are wrapped in objBag when returned.
*/
class objBag implements JsonSerializable {
class objBag implements JsonSerializable, ArrayAccess {
/** @var object */
private $wrapped;
public function __construct($wrapped)
@@ -86,7 +87,21 @@ class objBag implements JsonSerializable {
return null;
}
public function __isset($name)
public function __set($name, $value)
{
if ($this->wrapped) {
$this->wrapped->$name = $value;
}
}
public function __unset($name)
{
if ($this->wrapped) {
unset($this->wrapped->$name);
}
}
public function __isset($name)
{
return isset($this->wrapped->$name);
}
@@ -99,7 +114,7 @@ class objBag implements JsonSerializable {
public function has($name)
{
return isset($this->$name);
return isset($this->$name) && $this->$name !== null;
}
public function unpack()
@@ -107,6 +122,16 @@ class objBag implements JsonSerializable {
return $this->wrapped;
}
public function toArray()
{
return(array)$this->wrapped;
}
public function all()
{
return $this->toArray();
}
/**
* Specify data which should be serialized to JSON
*
@@ -119,6 +144,26 @@ class objBag implements JsonSerializable {
{
return $this->wrapped;
}
public function offsetExists($offset)
{
return isset($this->$offset);
}
public function offsetGet($offset)
{
return $this->$offset;
}
public function offsetSet($offset, $value)
{
$this->$offset = $value;
}
public function offsetUnset($offset)
{
unset($this->$offset);
}
}
function objBag($obj) {