Bitpay\Autoloader::register PHP Method

register() public static method

Some applications will throw exceptions if the class isn't found and some are not compatible with PSR standards.
public static register ( boolean $prepend = true )
$prepend boolean
    public static function register($prepend = true)
    {
        spl_autoload_register(array(__CLASS__, 'autoload'), true, (bool) $prepend);
    }

Usage Example

Example #1
0
 /**
  * Registers the BitPay autoloader to run before Magento's. This MUST be
  * called before using any bitpay classes.
  */
 public function registerAutoloader()
 {
     if ($this->useAutoloader() && true === empty($this->_autoloaderRegistered)) {
         $autoloader_filename = \Mage::getBaseDir('lib') . '/Bitpay/Autoloader.php';
         if (true === is_file($autoloader_filename) && true === is_readable($autoloader_filename)) {
             require_once $autoloader_filename;
             \Bitpay\Autoloader::register();
             $this->_autoloaderRegistered = true;
             $this->debugData('[INFO] In Bitpay_Core_Helper_Data::registerAutoloader(): autoloader file was found and has been registered.');
         } else {
             $this->_autoloaderRegistered = false;
             $this->debugData('[ERROR] In Bitpay_Core_Helper_Data::registerAutoloader(): autoloader file was not found or is not readable. Cannot continue!');
             throw new \Exception('In Bitpay_Core_Helper_Data::registerAutoloader(): autoloader file was not found or is not readable. Cannot continue!');
         }
     }
 }
All Usage Examples Of Bitpay\Autoloader::register