Advertisement
sathyashrayan

zf2 test code for factory

Aug 27th, 2015
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. interface Links{
  2.    /* return $links as array of links */
  3.    public function getLinks($links= array());
  4.  
  5. }
  6.  
  7. class RouterManager implements Links{
  8.     public function __construct($hostName){
  9.      $redirectTo = $hostName."Controller";
  10.      return $redirectTo;
  11.   }
  12.  
  13.     public function getLinks($links= array()){    
  14.         //all URI parsing operations to get the host name. Use foreach for the $links and return the host name      
  15.      return  $links;
  16.     }
  17. }
  18. use RouterManager;
  19. class HostnameFinder{
  20.      protected $toRedirect = null;
  21.      public function __construct (Links $links,$inputLink){ // Dependency Injection      
  22.         $toRedirect = $links->getLinks("set of links");
  23.         return new RouterManager( $toRedirect );
  24.      }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement