Forked from lstrojny/app--code--local--Varien--Autoload.php
Created
April 18, 2019 17:17
-
-
Save elfeffe/77a9d3c9fe210dbd71860831c2cc7049 to your computer and use it in GitHub Desktop.
Replace Magento autoloader with composer based autoloader. Note: you are losing the ability to use the compiler.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Classes source autoload | |
*/ | |
class Varien_Autoload | |
{ | |
/** @var \Composer\Autoload\ClassLoader */ | |
private static $autoloader; | |
/** @var self */ | |
private static $instance; | |
/** | |
* Singleton pattern implementation | |
* | |
* @return Varien_Autoload | |
*/ | |
static public function instance() | |
{ | |
if (!self::$instance) { | |
self::$instance = new Varien_Autoload(); | |
} | |
return self::$instance; | |
} | |
/** | |
* Register composer autoloader | |
*/ | |
static public function register() | |
{ | |
if (!static::$autoloader) { | |
static::$autoloader = require __DIR__ . '/../../../../vendor/autoload.php'; | |
} | |
} | |
/** | |
* Load class source code | |
* | |
* @param string $class | |
* @return bool | |
*/ | |
public function autoload($class) | |
{ | |
return static::$autoloader->loadClass($class); | |
} | |
public function registerScope($scope) | |
{} | |
public static function getScope() | |
{} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment