The autoload function is as follows:
<?php
spl_autoload_register(function ($_class){
$aClass = explode('\', $_class);
$class = end($aClass);
$baseDir = __DIR__;
$directories = glob($baseDir . '\*' , GLOB_ONLYDIR);
foreach ($directories as $baseDir){
$fileName = $baseDir.'\';
$fileName .= str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
if (file_exists($fileName))
require $fileName;
}
});
I made an echo of the $ filename variable and the result was "C: \ wamp \ www \ projectx \ api \ v1 \ libs \ PayPal \ Auth \ OAuthTokenCredential.php" p>
I checked the path and it's correct.
Within the "OAuthTokenCredential.php" file I have the following code:
namespace PayPal\Auth;
use PayPal\Cache\AuthorizationCache;
use PayPal\Common\PayPalResourceModel;
use PayPal\Core\PayPalHttpConfig;
use PayPal\Core\PayPalHttpConnection;
use PayPal\Core\PayPalLoggingManager;
use PayPal\Exception\PayPalConfigurationException;
use PayPal\Exception\PayPalConnectionException;
use PayPal\Handler\IPayPalHandler;
use PayPal\Rest\ApiContext;
use PayPal\Security\Cipher;
class OAuthTokenCredential extends PayPalResourceModel{
//...
}
The class name is correct, " OAuthTokenCredential ".
If the path to the class is correct, the class name is correct because it returns the error " Fatal error: Class 'OAuthTokenCredential' not found in ...