Ok, so I'm trying to understand some of these patterns.
Well, thatβs why I am encoding the application in CodeIgniter, which should be able to send data about the machine and the client to different types of companies using SOAP, possibly XML, separated by commas, etc.
But they all need the same thing.
I want to make it as dynamic as possible and make sure that it easily records tests.
Thus, the service should take a couple of things:
- handler
- applicants [1-2]
- PARAMS
- an object
I started to create different classes
Gr8Exp NordCar SwePerf
each implementing iServiceRequest interface
interface iServiceRequest{ function sendRequest(); function saveResponse(); function prepareRequest(); function setRequestHandler(iServiceRequestHandler $handler); }
Then they need to structure the Soap, XML, CSV, JSON request depending on which handler I inserted.
After those who needed to pass validation (not all), I used:
interface iAdaptServiceRequest{ function structure(array $info); function validateInfo(); }
But I'm stuck, it worked very well when I just used a SOAP request; but now. Since I need to format them differently, use a different handler for each type of request or company, I donβt know what to do. I could put them in different folders and recreate the class in different folders. But this is not a good practice, since I duplicate the code throughout.
In the end, I want to run the chain as follows:
$ result = $ m-> prepareRequest () β sendRequest () β saveResponse ();
Any suggestions