Created
February 14, 2016 08:04
-
-
Save shadda/d3b1407f2bf5b5d35f5e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment