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