ParametersInterface.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. /**
  3. * Zend Framework (http://framework.zend.com/)
  4. *
  5. * @link http://github.com/zendframework/zf2 for the canonical source repository
  6. * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
  7. * @license http://framework.zend.com/license/new-bsd New BSD License
  8. */
  9. namespace Zend\Stdlib;
  10. use ArrayAccess;
  11. use Countable;
  12. use Serializable;
  13. use Traversable;
  14. /*
  15. * Basically, an ArrayObject. You could simply define something like:
  16. * class QueryParams extends ArrayObject implements Parameters {}
  17. * and have 90% of the functionality
  18. */
  19. interface ParametersInterface extends ArrayAccess, Countable, Serializable, Traversable
  20. {
  21. /**
  22. * Constructor
  23. *
  24. * @param array $values
  25. */
  26. public function __construct(array $values = null);
  27. /**
  28. * From array
  29. *
  30. * Allow deserialization from standard array
  31. *
  32. * @param array $values
  33. * @return mixed
  34. */
  35. public function fromArray(array $values);
  36. /**
  37. * From string
  38. *
  39. * Allow deserialization from raw body; e.g., for PUT requests
  40. *
  41. * @param $string
  42. * @return mixed
  43. */
  44. public function fromString($string);
  45. /**
  46. * To array
  47. *
  48. * Allow serialization back to standard array
  49. *
  50. * @return mixed
  51. */
  52. public function toArray();
  53. /**
  54. * To string
  55. *
  56. * Allow serialization to query format; e.g., for PUT or POST requests
  57. *
  58. * @return mixed
  59. */
  60. public function toString();
  61. /**
  62. * Get
  63. *
  64. * @param string $name
  65. * @param mixed|null $default
  66. * @return mixed
  67. */
  68. public function get($name, $default = null);
  69. /**
  70. * Set
  71. *
  72. * @param string $name
  73. * @param mixed $value
  74. * @return ParametersInterface
  75. */
  76. public function set($name, $value);
  77. }