This repository has been archived by the owner on Jan 8, 2020. It is now read-only.
/
InputFilterInterface.php
153 lines (136 loc) · 3.73 KB
/
InputFilterInterface.php
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_InputFilter
*/
namespace Zend\InputFilter;
use Countable;
use Traversable;
/**
* @category Zend
* @package Zend_InputFilter
*/
interface InputFilterInterface extends Countable
{
const VALIDATE_ALL = 'INPUT_FILTER_ALL';
/**
* Add an input to the input filter
*
* @param InputInterface|InputFilterInterface|array $input
* @param null|string $name Name used to retrieve this input
* @return InputFilterInterface
*/
public function add($input, $name = null);
/**
* Retrieve a named input
*
* @param string $name
* @return InputInterface|InputFilterInterface
*/
public function get($name);
/**
* Test if an input or input filter by the given name is attached
*
* @param string $name
* @return bool
*/
public function has($name);
/**
* Remove a named input
*
* @param string $name
* @return InputFilterInterface
*/
public function remove($name);
/**
* Set data to use when validating and filtering
*
* @param array|Traversable $data
* @return InputFilterInterface
*/
public function setData($data);
/**
* Is the data set valid?
*
* @return bool
*/
public function isValid();
/**
* Provide a list of one or more elements indicating the complete set to validate
*
* When provided, calls to {@link isValid()} will only validate the provided set.
*
* If the initial value is {@link VALIDATE_ALL}, the current validation group, if
* any, should be cleared.
*
* Implementations should allow passing a single array value, or multiple arguments,
* each specifying a single input.
*
* @param mixed $name
* @return InputFilterInterface
*/
public function setValidationGroup($name);
/**
* Return a list of inputs that were invalid.
*
* Implementations should return an associative array of name/input pairs
* that failed validation.
*
* @return InputInterface[]
*/
public function getInvalidInput();
/**
* Return a list of inputs that were valid.
*
* Implementations should return an associative array of name/input pairs
* that passed validation.
*
* @return InputInterface[]
*/
public function getValidInput();
/**
* Retrieve a value from a named input
*
* @param string $name
* @return mixed
*/
public function getValue($name);
/**
* Return a list of filtered values
*
* List should be an associative array, with the values filtered. If
* validation failed, this should raise an exception.
*
* @return array
*/
public function getValues();
/**
* Retrieve a raw (unfiltered) value from a named input
*
* @param string $name
* @return mixed
*/
public function getRawValue($name);
/**
* Return a list of unfiltered values
*
* List should be an associative array of named input/value pairs,
* with the values unfiltered.
*
* @return array
*/
public function getRawValues();
/**
* Return a list of validation failure messages
*
* Should return an associative array of named input/message list pairs.
* Pairs should only be returned for inputs that failed validation.
*
* @return array
*/
public function getMessages();
}