| 1 | <?php |
||
| 27 | class RegistrationsCreateResponse extends Response |
||
| 28 | { |
||
| 29 | protected $response; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Constructor |
||
| 33 | * |
||
| 34 | * @param object $response Actual response from SOAP |
||
| 35 | */ |
||
| 36 | 1 | public function __construct($response) |
|
| 40 | |||
| 41 | /** |
||
| 42 | * Add new registration to EDBBrugs |
||
| 43 | * |
||
| 44 | * @return mixed (number of successful registrations) or |
||
| 45 | * @throws \Exception |
||
| 46 | */ |
||
| 47 | public function getBody() |
||
| 48 | { |
||
| 49 | if (!$this->isOk()) { |
||
| 50 | throw new \Exception($this->response->NyTilmelding2Result); |
||
| 51 | } |
||
| 52 | return $this->response->NyTilmelding2Result; |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Checks whether the communication is a success |
||
| 57 | * |
||
| 58 | * @return boolean |
||
| 59 | */ |
||
| 60 | public function isOk() |
||
| 61 | { |
||
| 62 | $string = 'Oprettelse Ok, nye tilmeldinger'; |
||
| 63 | $result = strpos($this->response->NyTilmelding2Result, $string); |
||
| 64 | return ($result !== false); |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * Returns how many registrations has been created |
||
| 69 | * |
||
| 70 | * @return mixed |
||
| 71 | */ |
||
| 72 | 1 | public function getCount() |
|
| 80 | } |
||
| 81 |