trace ( 'Autoloading ' . $className ); $classPath = explode ( '_', $className ); // @jason: make sure the first segment of the classname is 'Postman' if (empty ( $classPath [0] ) || empty ( $classPath [1] )) { return; } if ($classPath [0] != 'Postman' && $classPath [1] != 'Google') { return; } else { // @jason: get rid of the first segment of the classname $classPath = array_slice ( $classPath, 1 ); } if (count ( $classPath ) > 3) { // Maximum class file path depth in this project is 3. $classPath = array_slice ( $classPath, 1, 4 ); } $filePath = dirname ( __FILE__ ) . '/src/' . implode ( '/', $classPath ) . '.php'; if (file_exists ( $filePath )) { require_once ($filePath); } } spl_autoload_register ( 'postman_google_api_php_client_autoload' );