arguments.class.php 668 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. class Arguments implements JsonSerializable, ArrayAccess{
  3. public $args;
  4. public function __construct($args){
  5. $this->args = $args;
  6. }
  7. public function jsonSerialize(){
  8. return $this->args;
  9. }
  10. public function __toString(){
  11. return $this->path;
  12. }
  13. public function __get($name){
  14. if(isset($this->args[$name])){
  15. return $this->args[$name];
  16. }
  17. }
  18. public function offsetGet($key){
  19. return $this->args[$key];
  20. }
  21. public function offsetExists($key){
  22. return isset($this->args[$key]);
  23. }
  24. public function offsetSet($key,$val){
  25. $this->args[$key] = $val;
  26. }
  27. public function offsetUnset($key){
  28. unset($this->args[$key]);
  29. }
  30. }
  31. ?>