Skip to content

Commit 5e7a32f

Browse files
author
Jan Herzan
committed
Custom config added to the rest of methods.
1 parent 1729bc4 commit 5e7a32f

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

factories/ContactFactory.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ public static function getAll($custom_config = NULL)
7474
return $contactsArray;
7575
}
7676

77-
public static function getBySelfURL($selfURL)
77+
public static function getBySelfURL($selfURL, $custom_config = NULL)
7878
{
79-
$client = GoogleHelper::getClient();
79+
$client = GoogleHelper::getClient($custom_config);
8080

8181
$req = new \Google_Http_Request($selfURL);
8282

@@ -137,9 +137,9 @@ public static function getBySelfURL($selfURL)
137137
return new Contact($contactDetails);
138138
}
139139

140-
public static function submitUpdates(Contact $updatedContact)
140+
public static function submitUpdates(Contact $updatedContact, $custom_config = NULL)
141141
{
142-
$client = GoogleHelper::getClient();
142+
$client = GoogleHelper::getClient($custom_config);
143143

144144
$req = new \Google_Http_Request($updatedContact->selfURL);
145145

@@ -215,7 +215,7 @@ public static function submitUpdates(Contact $updatedContact)
215215
return new Contact($contactDetails);
216216
}
217217

218-
public static function create($name, $phoneNumber, $emailAddress)
218+
public static function create($name, $phoneNumber, $emailAddress, $custom_config = NULL)
219219
{
220220
$doc = new \DOMDocument();
221221
$doc->formatOutput = true;
@@ -239,7 +239,7 @@ public static function create($name, $phoneNumber, $emailAddress)
239239

240240
$xmlToSend = $doc->saveXML();
241241

242-
$client = GoogleHelper::getClient();
242+
$client = GoogleHelper::getClient($custom_config);
243243

244244
$req = new \Google_Http_Request('https://www.google.com/m8/feeds/contacts/default/full');
245245
$req->setRequestHeaders(array('content-type' => 'application/atom+xml; charset=UTF-8; type=feed'));
@@ -287,9 +287,9 @@ public static function create($name, $phoneNumber, $emailAddress)
287287
return new Contact($contactDetails);
288288
}
289289

290-
public static function delete(Contact $toDelete)
290+
public static function delete(Contact $toDelete, $custom_config = NULL)
291291
{
292-
$client = GoogleHelper::getClient();
292+
$client = GoogleHelper::getClient($custom_config);
293293

294294
$req = new \Google_Http_Request($toDelete->editURL);
295295
$req->setRequestHeaders(array('content-type' => 'application/atom+xml; charset=UTF-8; type=feed'));
@@ -298,9 +298,9 @@ public static function delete(Contact $toDelete)
298298
$client->getAuth()->authenticatedRequest($req);
299299
}
300300

301-
public static function getPhoto($photoURL)
301+
public static function getPhoto($photoURL, $custom_config = NULL)
302302
{
303-
$client = GoogleHelper::getClient();
303+
$client = GoogleHelper::getClient($custom_config);
304304
$req = new \Google_Http_Request($photoURL);
305305
$req->setRequestMethod('GET');
306306
$val = $client->getAuth()->authenticatedRequest($req);

0 commit comments

Comments
 (0)