Skip to content

Commit 771d484

Browse files
committed
Merge pull request googleapis#493 from glensc/autoload
setup autoloader from classes only if no autoloader detected
2 parents 22a51b2 + d8de318 commit 771d484

36 files changed

+108
-36
lines changed

src/Google/Auth/Abstract.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
* limitations under the License.
1616
*/
1717

18-
require_once realpath(dirname(__FILE__) . '/../autoload.php');
18+
if (!class_exists('Google_Client')) {
19+
require_once dirname(__FILE__) . '/../autoload.php';
20+
}
1921

2022
/**
2123
* Abstract class for the Authentication in the API client

src/Google/Auth/AppIdentity.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
*/
2323
use google\appengine\api\app_identity\AppIdentityService;
2424

25-
require_once realpath(dirname(__FILE__) . '/../autoload.php');
25+
if (!class_exists('Google_Client')) {
26+
require_once dirname(__FILE__) . '/../autoload.php';
27+
}
2628

2729
/**
2830
* Authentication via the Google App Engine App Identity service.

src/Google/Auth/AssertionCredentials.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
* limitations under the License.
1616
*/
1717

18-
require_once realpath(dirname(__FILE__) . '/../autoload.php');
18+
if (!class_exists('Google_Client')) {
19+
require_once dirname(__FILE__) . '/../autoload.php';
20+
}
1921

2022
/**
2123
* Credentials object used for OAuth 2.0 Signed JWT assertion grants.

src/Google/Auth/ComputeEngine.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
* limitations under the License.
1616
*/
1717

18-
require_once realpath(dirname(__FILE__) . '/../autoload.php');
18+
if (!class_exists('Google_Client')) {
19+
require_once dirname(__FILE__) . '/../autoload.php';
20+
}
1921

2022
/**
2123
* Authentication via built-in Compute Engine service accounts.

src/Google/Auth/Exception.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
* limitations under the License.
1616
*/
1717

18-
require_once realpath(dirname(__FILE__) . '/../autoload.php');
18+
if (!class_exists('Google_Client')) {
19+
require_once dirname(__FILE__) . '/../autoload.php';
20+
}
1921

2022
class Google_Auth_Exception extends Google_Exception
2123
{

src/Google/Auth/LoginTicket.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
* limitations under the License.
1616
*/
1717

18-
require_once realpath(dirname(__FILE__) . '/../autoload.php');
18+
if (!class_exists('Google_Client')) {
19+
require_once dirname(__FILE__) . '/../autoload.php';
20+
}
1921

2022
/**
2123
* Class to hold information about an authenticated login.

src/Google/Auth/OAuth2.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
* limitations under the License.
1616
*/
1717

18-
require_once realpath(dirname(__FILE__) . '/../autoload.php');
18+
if (!class_exists('Google_Client')) {
19+
require_once dirname(__FILE__) . '/../autoload.php';
20+
}
1921

2022
/**
2123
* Authentication class that deals with the OAuth 2 web-server authentication flow

src/Google/Auth/Simple.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
* limitations under the License.
1616
*/
1717

18-
require_once realpath(dirname(__FILE__) . '/../autoload.php');
18+
if (!class_exists('Google_Client')) {
19+
require_once dirname(__FILE__) . '/../autoload.php';
20+
}
1921

2022
/**
2123
* Simple API access implementation. Can either be used to make requests

src/Google/Cache/Apc.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
* limitations under the License.
1616
*/
1717

18-
require_once realpath(dirname(__FILE__) . '/../autoload.php');
18+
if (!class_exists('Google_Client')) {
19+
require_once dirname(__FILE__) . '/../autoload.php';
20+
}
1921

2022
/**
2123
* A persistent storage class based on the APC cache, which is not

src/Google/Cache/Exception.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
* limitations under the License.
1616
*/
1717

18-
require_once realpath(dirname(__FILE__) . '/../autoload.php');
18+
if (!class_exists('Google_Client')) {
19+
require_once dirname(__FILE__) . '/../autoload.php';
20+
}
1921

2022
class Google_Cache_Exception extends Google_Exception
2123
{

0 commit comments

Comments
 (0)