1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49:
<?php
namespace WPGMZA;
class QueryFragment implements \ArrayAccess
{
private $nextIndex = 0;
public function offsetExists($offset)
{
return property_exists($this, $offset);
}
public function offsetGet($offset)
{
return $this->{$offset};
}
public function offsetSet($offset, $value)
{
if(!$offset)
$offset = $this->nextIndex++;
$this->{$offset} = $value;
}
public function offsetUnset($offset)
{
unset($this->{$offset});
}
public function reset()
{
foreach($this as $key => $value)
unset($this->{$key});
}
public function toArray()
{
$arr = (array)$this;
array_shift($arr);
return $arr;
}
}
class_alias('WPGMZA\\QueryFragment', 'WPGMZA\\QueryFields');