Skip to content

Commit 1729bc4

Browse files
author
Jan Herzan
committed
Custom config is now available for getClient method.
1 parent 83bb510 commit 1729bc4

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

factories/ContactFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
abstract class ContactFactory
99
{
10-
public static function getAll()
10+
public static function getAll($custom_config = NULL)
1111
{
12-
$client = GoogleHelper::getClient();
12+
$client = GoogleHelper::getClient($custom_config);
1313

1414
$req = new \Google_Http_Request('https://www.google.com/m8/feeds/contacts/default/full?max-results=10000&updated-min=2007-03-16T00:00:00');
1515

helpers/GoogleHelper.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ public static function initConfig(
2121
self::$_config->refreshToken = $refreshToken;
2222
}
2323

24-
private static function loadConfig()
24+
private static function loadConfig($custom_config = NULL)
2525
{
26+
self::$_config = $custom_config;
2627
if (NULL === self::$_config) {
2728
$configPath = __DIR__.'/../../../../.config.json';
2829
if(!file_exists($configPath)) throw new \Exception('Not found config.json');
@@ -33,9 +34,9 @@ private static function loadConfig()
3334
return self::$_config;
3435
}
3536

36-
public static function getClient()
37+
public static function getClient($custom_config = NULL)
3738
{
38-
$config = self::loadConfig();
39+
$config = self::loadConfig($custom_config);
3940

4041
$client = new \Google_Client();
4142

0 commit comments

Comments
 (0)