PHP Classes

File: vendor/fzaninotto/faker/src/autoload.php

Recommend this page to a friend!
  Classes of Abed Nego Ragil Putra   Laravel Blogging Platform   vendor/fzaninotto/faker/src/autoload.php   Download  
File: vendor/fzaninotto/faker/src/autoload.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Laravel Blogging Platform
Manage blog posts using Laravel and Bootstrap
Author: By
Last change:
Date: 5 years ago
Size: 878 bytes
 

Contents

Class file image Download
<?php

/**
 * Simple autoloader that follow the PHP Standards Recommendation #0 (PSR-0)
 * @see https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md for more informations.
 *
 * Code inspired from the SplClassLoader RFC
 * @see https://wiki.php.net/rfc/splclassloader#example_implementation
 */
spl_autoload_register(function ($className) {
   
$className = ltrim($className, '\\');
   
$fileName = '';
    if (
$lastNsPos = strripos($className, '\\')) {
       
$namespace = substr($className, 0, $lastNsPos);
       
$className = substr($className, $lastNsPos + 1);
       
$fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
    }
   
$fileName = __DIR__ . DIRECTORY_SEPARATOR . $fileName . $className . '.php';
    if (
file_exists($fileName)) {
        require
$fileName;

        return
true;
    }

    return
false;
});