Hacker News new | ask | show | jobs
by dschiptsov 4522 days ago

   if (strcmp($POST['cardtype'], "mastercard")) {
      $Processor = $PaymentProcessorFactory.InstantiateByType("mastercard");
      $Processor = $PaymentProcessorFactory.InstantiateByType("visa");
   }
   $Processor.process($POST);
Sorry, cannot simulate "real-world" (lame enough) PHP OO code, but you got the idea.)