1 | <?php |
||
27 | class Client implements ClientInterface |
||
28 | { |
||
29 | protected $soap; |
||
30 | protected $credentials; |
||
31 | |||
32 | /** |
||
33 | * Constructor |
||
34 | * |
||
35 | * @param object $soap Soap Client |
||
36 | */ |
||
37 | public function __construct(CredentialsInterface $credentials, $soap) |
||
42 | |||
43 | /** |
||
44 | * Create new registrations from array |
||
45 | * |
||
46 | * @param array $registrations |
||
47 | * |
||
48 | * @return RegistrationsCreateResponse |
||
49 | */ |
||
50 | public function createNewRegistrations(array $registrations) |
||
51 | { |
||
52 | $xml = new \SimpleXMLElement('<Tilmeldinger/>'); |
||
53 | $user = $xml->addChild('User'); |
||
54 | $user->addChild('Username', $this->credentials->getUsername()); |
||
55 | $user->addChild('Passw', $this->credentials->getPassword()); |
||
56 | $user->addChild('Skolekode', $this->credentials->getSchoolCode()); |
||
57 | foreach ($registrations as $registration) { |
||
58 | $reg = $xml->addChild('Tilmelding'); |
||
59 | foreach ($registration as $key => $value) { |
||
60 | $reg->addChild($key, $value); |
||
61 | } |
||
62 | } |
||
63 | |||
64 | $params = array(); |
||
65 | $params['XmlData'] = new \SoapVar($xml->asXml(), XSD_STRING); |
||
66 | |||
67 | return new RegistrationsCreateResponse($this->soap->NyTilmelding2($params)); |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * Gets new registrations |
||
72 | * |
||
73 | * @return Response |
||
74 | */ |
||
75 | public function getNewRegistrations() |
||
80 | |||
81 | /** |
||
82 | * Gets handled registrations |
||
83 | * |
||
84 | * @return Response |
||
85 | */ |
||
86 | public function getHandledRegistrations() |
||
91 | |||
92 | /** |
||
93 | * Delete registrations |
||
94 | * |
||
95 | * @throws \Exception |
||
96 | * @return void |
||
97 | */ |
||
98 | public function deleteRegistrations() |
||
102 | } |
||
103 |