Skip to content

Commit 7f1b9b1

Browse files
authored
Merge pull request #23 from lucascdsilva/master
Change parse xml for array phoneNumber and email
2 parents 77842c2 + e9df97d commit 7f1b9b1

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

factories/ContactFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ public static function getAll()
5151
$attributes = $value->attributes();
5252
$emailadress = (string) $attributes['address'];
5353
$emailtype = substr(strstr($attributes['rel'], '#'), 1);
54-
$contactDetails[$key][$emailtype] = $emailadress;
54+
$contactDetails[$key][] = ['type' => $emailtype, 'email' => $emailadress];
5555
break;
5656
case 'phoneNumber':
5757
$attributes = $value->attributes();
5858
$uri = (string) $attributes['uri'];
5959
$type = substr(strstr($attributes['rel'], '#'), 1);
6060
$e164 = substr(strstr($uri, ':'), 1);
61-
$contactDetails[$key][$type] = $e164;
61+
$contactDetails[$key][] = ['type' => $type, 'number' => $e164];
6262
break;
6363
default:
6464
$contactDetails[$key] = (string) $value;

helpers/GoogleHelper.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ abstract class GoogleHelper
66
{
77
private static function loadConfig()
88
{
9-
$contents = file_get_contents(__DIR__.'/../.config.json');
10-
9+
$configPath = __DIR__.'/../../../../.config.json';
10+
if(!file_exists($configPath)) throw new \Exception('Not found config.json');
11+
$contents = file_get_contents($configPath);
1112
$config = json_decode($contents);
1213

1314
return $config;

0 commit comments

Comments
 (0)