Advertisement
Guest User

Untitled

a guest
Feb 14th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. interface IFormHandler
  5. {
  6. public function validate();
  7. }
  8.  
  9. class FormHandler
  10. {
  11. const METHOD_GET = 2;
  12. const METHOD_POST = 4;
  13.  
  14. protected $_request = [];
  15. protected $_fields = [];
  16. protected $_optional = [];
  17.  
  18. protected $_method = self::METHOD_GET;
  19.  
  20. public function __construct(array $request = [], $method = self::METHOD_GET)
  21. {
  22. $this->_request = $request;
  23. $this->_method = $method;
  24. }
  25. }
  26.  
  27. class ContactForm extends FormHandler
  28. {
  29. protected $_fields = ['fname', 'lname', 'email', 'salutation', 'title'];
  30. protected $_optional ['salutation', 'title'];
  31.  
  32. public function validate()
  33. {
  34. //validation as discussed here
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement