Advertisement
Danack

Untitled

Oct 27th, 2014
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.47 KB | None | 0 0
  1. function createService($type, TableA $tableA, TableB $tableB, TableC $tableC) {
  2.  
  3.     switch($type) {
  4.    
  5.         case(0): {
  6.             return new Service($tableA, $tableB, $tableC);
  7.         }
  8.         default:
  9.         case(1): {
  10.             return new Service($tableC, $tableB, $tableA);
  11.         }
  12.     }
  13.  
  14. }
  15.  
  16.  
  17. $injector->delegate('Service', 'createService');
  18.  
  19. $serivceType0 = $injector->make('Service', [':type' => 0]);
  20. $serivceType1 = $injector->make('Service', [':type' => 1]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement