Skip to content

Commit

Permalink
Removing the support for OPL Cache in ClassMapLoader. This will be im…
Browse files Browse the repository at this point in the history
…plemented as a separate autoloader.
  • Loading branch information
zyxist committed Jun 14, 2011
1 parent 22b6462 commit 74a8ac0
Showing 1 changed file with 2 additions and 27 deletions.
29 changes: 2 additions & 27 deletions src/Opl/Autoloader/ClassMapLoader.php
Expand Up @@ -11,7 +11,6 @@
*/
namespace Opl\Autoloader;
use RuntimeException;
use Opl\Cache\Cache;

/**
* This autoloader is based on the pre-computed class location
Expand Down Expand Up @@ -56,36 +55,12 @@ class ClassMapLoader
*
* @param string $defaultPath The default location path used for newly registered namespaces
* @param string $classMapLocation The class map location on the disk
* @param Cache $cache The optional memory cache to be used
*/
public function __construct($defaultPath, $classMapLocation, Cache $cache = null)
public function __construct($defaultPath, $classMapLocation)
{
$this->setDefaultPath($defaultPath);
$this->classMapLocation = $classMapLocation;

if(null !== $cache)
{
$this->classMap = $cache->get('classMap');
if(null === $this->classMap)
{
$this->_loadMap();
$cache->set('classMap', $this->classMap);
}
}
else
{
$this->_loadMap();
}
} // end __construct();

/**
* Loads the map from a file.
*
* @internal
* @throws RuntimeException
*/
protected function _loadMap()
{
if(!file_exists($this->classMapLocation))
{
throw new RuntimeException('Cannot find a class map under the specified location.');
Expand All @@ -96,7 +71,7 @@ protected function _loadMap()
{
throw new RuntimeException('The loaded file does not contain a valid class map.');
}
} // end _loadMap();
} // end __construct();

/**
* Registers a new top-level namespace to match. If no path is specified, the current
Expand Down

0 comments on commit 74a8ac0

Please sign in to comment.