Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 KB | None | 0 0
  1. <?php
  2. // This is a model
  3. interface HasBalance {
  4.     public function addToBalance(amount);
  5. }
  6.  
  7. class Customer implements HasBalance {
  8.     public $name;
  9.     public $description;
  10.     ...
  11.  
  12.     static function getById($id) {
  13.         ...
  14.     }
  15.  
  16.     public function addToBalance(amount) {
  17.         ...
  18.     }
  19. }
  20.  
  21. class Company implements HasBalance {
  22.     public function addToBalance(amount) {
  23.         ...
  24.     }
  25. }
  26.  
  27. // This is a controller
  28. class AccountInformation extends HttpController {
  29.     public function execute(HttpRequest $httpRequest) {
  30.         $info = Customer::getById($httpRequest->query->id);
  31.         $view = View::create('account_information.html', $info);
  32.         return new HttpResponse($view);
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement