Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit c916658

Browse files
committed
Merge branch 'hotfix/93'
Close #93
2 parents abe578c + d9861c2 commit c916658

File tree

1 file changed

+57
-19
lines changed

1 file changed

+57
-19
lines changed

doc/book/zend.input-filter.intro.md

Lines changed: 57 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -173,28 +173,66 @@ properties based on our compound set of filters.
173173

174174
```php
175175
use Zend\InputFilter\InputFilter;
176-
```
177176

178-
> /*\** Filter to ensure a name property is set and > 8 characters
179-
*/ class NameInputFilter extends InputFilter { /*\* Filter body goes here \*\*/ }
180-
/*\** Filter to ensure an email property is set and > 8 characters and is valid
181-
\*/
182-
class EmailInputFilter extends InputFilter { /*\* Filter body goes here*\*/ }
183-
class SimplePerson { /*\* Member variables ommitted for berevity*\*/
184-
/*\* @var InputFilter*/ protected $inputFilter;
185-
/*\** Retrieve input filter
186-
\* \* @return InputFilter \*/
187-
public function getInputFilter() { if (!$this->inputFilter) { // Create a new input filter
188-
$this->inputFilter = new InputFilter(); // Merge our inputFilter in for the email property
189-
$this->inputFilter->merge(new EmailInputFilter()); // Merge our inputFilter in for the name
190-
property $this->inputFilter->merge(new NameInputFilter()); } return $this->inputFilter; }
191-
/*\** Set input filter
192-
\* \* @param InputFilterInterface $inputFilter \* @return SimplePerson \*/
193-
public function setInputFilter(InputFilterInterface $inputFilter) { $this->inputFilter =
194-
$inputFilter;
195-
return $this;
177+
/**
178+
* Filter to ensure a name property is set and > 8 characters
179+
*/
180+
class NameInputFilter extends InputFilter
181+
{
182+
/** Filter body goes here **/
183+
}
184+
185+
/**
186+
* Filter to ensure an email property is set and > 8 characters and is valid
187+
*/
188+
class EmailInputFilter extends InputFilter
189+
{
190+
/** Filter body goes here **/
196191
}
192+
193+
class SimplePerson
194+
{
195+
/** Member variables ommitted for berevity **/
196+
197+
/** @var InputFilter */
198+
protected $inputFilter;
199+
200+
/**
201+
* Retrieve input filter
202+
*
203+
* @return InputFilter
204+
*/
205+
public function getInputFilter()
206+
{
207+
if (! $this->inputFilter) {
208+
// Create a new input filter
209+
$this->inputFilter = new InputFilter();
210+
211+
// Merge our inputFilter in for the email property
212+
$this->inputFilter->merge(new EmailInputFilter());
213+
214+
// Merge our inputFilter in for the name property
215+
$this->inputFilter->merge(new NameInputFilter());
216+
}
217+
218+
return $this->inputFilter;
219+
}
220+
221+
/**
222+
* Set input filter
223+
*
224+
* @param InputFilterInterface $inputFilter
225+
* @return SimplePerson
226+
*/
227+
public function setInputFilter(InputFilterInterface $inputFilter)
228+
{
229+
$this->inputFilter = $inputFilter;
230+
231+
return $this;
232+
}
197233
}
234+
```
235+
198236
Also see
199237

200238
- Zend\\\\Filter<zend.filter.introduction>

0 commit comments

Comments
 (0)