1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- /**
- * Simple PSR-4 autoloader
- * @param string $class Class name
- */
- spl_autoload_register(function($class) {
- // Package namespace
- $prefix = 'Fr\\RetailMeNot\\Cloud\\StateMachine\\';
- // Source folder
- $src = dirname(__FILE__).'/src/';
- // Does the class use the namespace prefix ?
- $len = strlen($prefix);
- // If no, move to next autoloader ...
- if (strncmp($prefix, $class, $len) !== 0) {
- return;
- }
- // Get relative class name
- $relative = substr($class, $len);
- // Build class path
- $file = $src.str_replace('\\', DIRECTORY_SEPARATOR, $relative).'.php';
- // If the file exists, require once it
- if (file_exists($file)) {
- require_once $file;
- }
- });
|