Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- interface IFormHandler
- {
- public function validate();
- }
- class FormHandler
- {
- const METHOD_GET = 2;
- const METHOD_POST = 4;
- protected $_request = [];
- protected $_fields = [];
- protected $_optional = [];
- protected $_method = self::METHOD_GET;
- public function __construct(array $request = [], $method = self::METHOD_GET)
- {
- $this->_request = $request;
- $this->_method = $method;
- }
- }
- class ContactForm extends FormHandler
- {
- protected $_fields = ['fname', 'lname', 'email', 'salutation', 'title'];
- protected $_optional ['salutation', 'title'];
- public function validate()
- {
- //validation as discussed here
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement