1
0

arguments.class.php 765 B

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