for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Article\Filter;
use Zend\InputFilter\InputFilter;
use Zend\InputFilter\InputFilterAwareInterface;
use Zend\InputFilter\InputFilterInterface;
class PostFilter implements InputFilterAwareInterface
{
protected $inputFilter;
public function getInputFilter()
if (!$this->inputFilter) {
$inputFilter = new InputFilter();
$inputFilter->add(
[
'name' => 'title',
'required' => true,
'filters' => [['name' => 'StringTrim']],
'validators' => [
['name' => 'NotEmpty'],
['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]],
],
]
);
'name' => 'body',
['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100000]],
'name' => 'lead',
['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 50000]],
'name' => 'has_layout',
'required' => false,
'filters' => [['name' => 'Boolean']],
$this->inputFilter = $inputFilter;
}
return $this->inputFilter;
public function setInputFilter(InputFilterInterface $inputFilter)
throw new \Exception('Not used');