Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
francisbesset committed Jan 16, 2013
0 parents commit a42396d
Show file tree
Hide file tree
Showing 9 changed files with 1,571 additions and 0 deletions.
21 changes: 21 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "besimple/memcached",
"type": "library",
"description": "Library for memcached",
"keywords": ["memcached", "cache"],
"license": "MIT",
"authors": [
{
"name": "Francis Besset",
"email": "[email protected]"
}
],
"require": {
"php": ">=5.2"
},
"autoload": {
"psr-0": {
"BeSimple_Memcached_": "lib/"
}
}
}
31 changes: 31 additions & 0 deletions lib/BeSimple/Memcached/Autoloader.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

class BeSimple_Memcached_Autoloader
{
/**
* Registers BeSimple_Memcached_Autoloader as an SPL autoloader.
*/
public static function register()
{
ini_set('unserialize_callback_func', 'spl_autoload_call');
spl_autoload_register(array(new self, 'autoload'));
}

/**
* Handles autoloading of classes.
*
* @param string $class A class name.
*/
public function autoload($class)
{
if (0 !== strpos($class, 'BeSimple_Memcached_')) {
return false;
}

if (is_file($file = dirname(__FILE__).'/../../'.str_replace(array('_', "\0"), array('/', ''), $class).'.php')) {
require $file;

return true;
}
}
}
Loading

0 comments on commit a42396d

Please sign in to comment.