Skip to content

Commit a7fecc0

Browse files
committed
Merge pull request #799 from deconf/patch-2
PHP 5.2.x compatibility issue
2 parents 09701cc + 8aa971b commit a7fecc0

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

src/Google/autoload.php

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,17 @@
1515
* limitations under the License.
1616
*/
1717

18-
spl_autoload_register(
19-
function ($className) {
20-
$classPath = explode('_', $className);
21-
if ($classPath[0] != 'Google') {
22-
return;
23-
}
24-
// Drop 'Google', and maximum class file path depth in this project is 3.
25-
$classPath = array_slice($classPath, 1, 2);
26-
27-
$filePath = dirname(__FILE__) . '/' . implode('/', $classPath) . '.php';
28-
if (file_exists($filePath)) {
29-
require_once($filePath);
30-
}
31-
}
32-
);
18+
function google_api_php_client_autoload($className)
19+
{
20+
$classPath = explode('_', $className);
21+
if ($classPath[0] != 'Google') {
22+
return;
23+
}
24+
// Drop 'Google', and maximum class file path depth in this project is 3.
25+
$classPath = array_slice($classPath, 1, 2);
26+
$filePath = dirname(__FILE__) . '/' . implode('/', $classPath) . '.php';
27+
if (file_exists($filePath)) {
28+
require_once($filePath);
29+
}
30+
}
31+
spl_autoload_register('google_api_php_client_autoload');

0 commit comments

Comments
 (0)