-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathOfficesResponse.php
55 lines (50 loc) · 1.97 KB
/
OfficesResponse.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
declare(strict_types=1);
namespace SergeyNezbritskiy\PrivatBank\Response;
use SergeyNezbritskiy\PrivatBank\Base\AbstractResponse;
/**
* Class OfficesResponse
* @package SergeyNezbritskiy\PrivatBank\Response
*/
class OfficesResponse extends AbstractResponse
{
/**
* Response Sample
* ```xml
* <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
* <pboffice>
* <pboffice country="Украина" state="Днепропетровская" city="Днепр" index="49000"
* address="ул Титова 29-М" phone="8(056)373-33-54, 373-33-56"
* email="julija.tverdokhlebovapbank.com.ua" name="Южное отд., Отделение №30"/>
* <pboffice country="Украина" state="Днепропетровская" city="Днепр" index="49055"
* address="ул Титова 9" phone="8(056)771-20-83"
* email="elena.vasikpbank.com.ua" name="ДГРУ, Отделение N41"/>
* </pboffice>
* ```
* @return array
*/
public function getData(): array
{
$xml = $this->getXmlContent();
/** @var \DOMNodeList $offices */
$offices = $xml->getElementsByTagName('pboffice');
$result = [];
/** @var \DOMElement $office */
foreach ($offices as $office) {
if ($office->getNodePath() === '/pboffice') {
continue;
}
$result[] = [
'country' => $office->getAttribute('country'),
'state' => $office->getAttribute('state'),
'city' => $office->getAttribute('city'),
'index' => $office->getAttribute('index'),
'address' => $office->getAttribute('address'),
'phone' => $office->getAttribute('phone'),
'email' => $office->getAttribute('email'),
'name' => $office->getAttribute('name'),
];
}
return $result;
}
}