1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* SDK to communicate with EDBBrugs |
4
|
|
|
* |
5
|
|
|
* PHP Version 5 |
6
|
|
|
* |
7
|
|
|
* @category EDBBrugs |
8
|
|
|
* @package EDBBrugs |
9
|
|
|
* @author Lars Olesen <[email protected]> |
10
|
|
|
* @license MIT Open Source License https://opensource.org/licenses/MIT |
11
|
|
|
* @version GIT: <git_id> |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace EDBBrugs; |
15
|
|
|
|
16
|
|
|
use EDBBrugs\ClientInterface; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Service Communicator with EDB-Brugs |
20
|
|
|
* |
21
|
|
|
* @category EDBBrugs |
22
|
|
|
* @package EDBBrugs |
23
|
|
|
* @author Lars Olesen <[email protected]> |
24
|
|
|
* @license MIT Open Source License https://opensource.org/licenses/MIT |
25
|
|
|
* @version GIT: <git_id> |
26
|
|
|
*/ |
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) |
38
|
|
|
{ |
39
|
|
|
$this->credentials = $credentials; |
40
|
|
|
$this->soap = $soap; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @param array $registrations |
45
|
|
|
*/ |
46
|
|
|
public function createNewRegistrations(array $registrations) |
47
|
|
|
{ |
48
|
|
|
$xml = new \SimpleXMLElement('<Tilmeldinger/>'); |
49
|
|
|
$user = $xml->addChild('User'); |
50
|
|
|
$user->addChild('Username', $this->credentials->getUsername()); |
51
|
|
|
$user->addChild('Passw', $this->credentials->getPassword()); |
52
|
|
|
$user->addChild('Skolekode', $this->credentials->getSchoolCode()); |
53
|
|
|
foreach ($registrations as $registration) { |
54
|
|
|
$reg = $xml->addChild('Tilmelding'); |
55
|
|
|
foreach ($registration as $key => $value) { |
56
|
|
|
$reg->addChild($key, $value); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
$params = array(); |
61
|
|
|
$params['XmlData'] = new \SoapVar($xml->asXml(), XSD_STRING); |
62
|
|
|
|
63
|
|
|
return new NewRegistrationsResponse($this->soap->NyTilmelding2($params)); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function getNewRegistrations() |
67
|
|
|
{ |
68
|
|
|
$params = $this->credentials->getArray(); |
69
|
|
|
return new Response('HentNyeTilmeldingerV2', $this->soap->HentNyeTilmeldingerV2($params)); |
|
|
|
|
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
public function getHandledRegistrations() |
73
|
|
|
{ |
74
|
|
|
$params = $this->credentials->getArray(); |
75
|
|
|
return new Response('HentBehandledeTilmeldingerV2', $this->soap->HentBehandledeTilmeldingerV2($params)); |
|
|
|
|
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @param string $weblist_id |
80
|
|
|
*/ |
81
|
|
|
public function deleteRegistrations($weblist_id) |
82
|
|
|
{ |
83
|
|
|
$params = $this->credentials->getArray(); |
84
|
|
|
$params['Id_WebListe'] = '72200' . '_' . 'T3'; |
85
|
|
|
return new Response('SletTilmeldingerV2', $this->soap->SletTilmeldingerV2($params)); |
|
|
|
|
86
|
|
|
} |
87
|
|
|
} |
88
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: