Last active
December 24, 2015 01:10
-
-
Save leocavalcante/6722197 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| class Html { | |
| public function renderSelect($name, $options) { | |
| // | |
| } | |
| public function renderCampaignsSelect() { | |
| return $this->renderSelect('campaign_id', $repository->listsCampaigns()); | |
| } | |
| public function renderAccountsSelect() { | |
| return $this->renderSelect('account_id', $repository->listsAccounts()); | |
| } | |
| } | |
| class Repository { | |
| public function lists($repositoryName, $keyColumn, $valueColumn) { | |
| // | |
| } | |
| public function listsCampaigns() { | |
| return $this->lists('campaigns', 'id', 'name'); | |
| } | |
| public function listsAccounts() { | |
| return $this->lists('accounts', 'id', 'company'); | |
| } | |
| } | |
| # | |
| $html->renderCampaignsSelect(); | |
| $html->renderAccountsSelect(); |
This file contains hidden or 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 | |
| class Html { | |
| public function renderSelect($name, $options) { | |
| // | |
| } | |
| } | |
| class Repository { | |
| public function lists($repositoryName, $keyColumn, $valueColumn) { | |
| // | |
| } | |
| } | |
| # | |
| $html->renderSelect('campaign_id', $repository->lists('campaigns', 'id', 'name')); | |
| $html->renderSelect('account_id', $repository->lists('accounts', 'id', 'company')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment